Mercurial > public > sg101
comparison polls/admin.py @ 581:ee87ea74d46b
For Django 1.4, rearranged project structure for new manage.py.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 05 May 2012 17:10:48 -0500 |
parents | gpp/polls/admin.py@1f139de929c4 |
children |
comparison
equal
deleted
inserted
replaced
580:c525f3e0b5d0 | 581:ee87ea74d46b |
---|---|
1 ''' | |
2 This file contains the automatic admin site definitions for the polls models. | |
3 ''' | |
4 | |
5 from django.contrib import admin | |
6 from polls.models import Poll | |
7 from polls.models import Choice | |
8 | |
9 | |
10 class ChoiceInline(admin.TabularInline): | |
11 model = Choice | |
12 extra = 3 | |
13 raw_id_fields = ['voters'] | |
14 | |
15 | |
16 class PollAdmin(admin.ModelAdmin): | |
17 list_display = ['question', 'start_date', 'end_date', 'is_enabled'] | |
18 inlines = [ChoiceInline] | |
19 list_filter = ['start_date', 'end_date'] | |
20 search_fields = ['question'] | |
21 date_hierarchy = 'start_date' | |
22 | |
23 | |
24 admin.site.register(Poll, PollAdmin) |