from myapp polls models import Poll Choice from django contrib import

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
from myapp.polls.models import Poll, Choice
from django.contrib import admin
class ChoiceInline(admin.TabularInline):
model = Choice
extra = 3
class PollAdmin(admin.ModelAdmin):
#fields = ['pub_date','question']
list_display = ('question', 'pub_date', 'was_published_today')
fieldsets = [
(None, {'fields': ['question']})
,('Date information', {'fields': ['pub_date'], 'classes': ['collapse']})
]
inlines = [ChoiceInline]
list_filter = ['pub_date']
search_fields = ['question']
date_hierarchy = 'pub_date'
admin.site.register(Poll, PollAdmin)
#admin.site.register(Choice)