source: src/django_tutorial/polls/admin.py

Last change on this file was 9009, checked in by dennisw, 14 years ago

Stuk tutorial erbij, prototype model gemaakt.

File size: 521 bytes
Line 
1from polls.models import Poll, Choice
2from django.contrib import admin
3
4class ChoiceInline(admin.TabularInline):
5 model = Choice
6 extra = 3
7
8class PollAdmin(admin.ModelAdmin):
9 fieldsets = [
10 (None, {'fields': ['question']}),
11 ('Date information', {'fields': ['pub_date'], 'classes': ['collapse']}),
12 ]
13 inlines = [ChoiceInline]
14 list_display = ('question', 'pub_date', 'was_published_today')
15 list_filter = ['pub_date']
16 search_fields = ['question']
17 date_hierarchy = 'pub_date'
18
19admin.site.register(Poll, PollAdmin)
20
Note: See TracBrowser for help on using the repository browser.