Mercurial > public > sg101
annotate polls/admin.py @ 917:0365fdbb4d78
Fix app conflict with messages.
Django's messages app label conflicts with our messages app.
We can't easily rename our label as that will make us rename database tables.
Since our app came first we'll just customize Django messages label.
For Django 1.7.7 upgrade.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Mon, 06 Apr 2015 20:02:25 -0500 |
parents | ee87ea74d46b |
children |
rev | line source |
---|---|
gremmie@1 | 1 ''' |
gremmie@1 | 2 This file contains the automatic admin site definitions for the polls models. |
gremmie@1 | 3 ''' |
gremmie@1 | 4 |
gremmie@1 | 5 from django.contrib import admin |
gremmie@1 | 6 from polls.models import Poll |
gremmie@1 | 7 from polls.models import Choice |
gremmie@1 | 8 |
gremmie@1 | 9 |
gremmie@1 | 10 class ChoiceInline(admin.TabularInline): |
gremmie@1 | 11 model = Choice |
gremmie@1 | 12 extra = 3 |
bgneal@439 | 13 raw_id_fields = ['voters'] |
gremmie@1 | 14 |
gremmie@1 | 15 |
gremmie@1 | 16 class PollAdmin(admin.ModelAdmin): |
bgneal@439 | 17 list_display = ['question', 'start_date', 'end_date', 'is_enabled'] |
bgneal@439 | 18 inlines = [ChoiceInline] |
bgneal@439 | 19 list_filter = ['start_date', 'end_date'] |
bgneal@439 | 20 search_fields = ['question'] |
gremmie@1 | 21 date_hierarchy = 'start_date' |
gremmie@1 | 22 |
gremmie@1 | 23 |
gremmie@1 | 24 admin.site.register(Poll, PollAdmin) |