Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add desc field to Calendar data model and admin ui #418

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions schedule/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

@admin.register(Calendar)
class CalendarAdmin(admin.ModelAdmin):
list_display = ('name', 'slug')
list_display = ('name', 'slug', 'desc')
prepopulated_fields = {'slug': ('name',)}
search_fields = ['name']
fieldsets = (
(None, {
'fields': [
('name', 'slug'),
('name', 'slug', 'desc'),
]
}),
)
Expand All @@ -35,8 +35,8 @@ class CalendarRelationAdmin(admin.ModelAdmin):

@admin.register(Event)
class EventAdmin(admin.ModelAdmin):
list_display = ('title', 'start', 'end')
list_filter = ('start',)
list_display = ('title', 'calendar', 'start', 'end')
list_filter = ('calendar', 'start')
ordering = ('-start',)
date_hierarchy = 'start'
search_fields = ('title', 'description')
Expand Down
20 changes: 20 additions & 0 deletions schedule/migrations/0012_calendar_desc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-03-21 12:50
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('schedule', '0011_event_calendar_not_null'),
]

operations = [
migrations.AddField(
model_name='calendar',
name='desc',
field=models.CharField(default='', max_length=200, verbose_name='desc'),
),
]
1 change: 1 addition & 0 deletions schedule/models/calendars.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ class Calendar(models.Model):

name = models.CharField(_("name"), max_length=200)
slug = models.SlugField(_("slug"), max_length=200, unique=True)
desc = models.CharField(_("desc"), max_length=200, default="")
objects = CalendarManager()

class Meta(object):
Expand Down