~bigmadwolf/+junk/django-intro

« back to all changes in this revision

Viewing changes to polls/admin.py

  • Committer: Jérémy Subtil
  • Date: 2010-07-23 13:16:23 UTC
  • Revision ID: jeremy@ubuntu-20100723131623-7ocv8x1gvg9e12d2
Enhanced polls admin.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
from django_intro.polls.models import Poll, Choice
2
2
from django.contrib import admin
3
3
 
 
4
class ChoiceInline(admin.TabularInline):
 
5
    model = Choice
 
6
    extra = 3
 
7
 
4
8
class PollAdmin(admin.ModelAdmin):
5
9
    fieldsets = [
6
10
        (None,               {'fields': ['question']}),
7
11
        ('Date information', {'fields': ['pub_date'], 'classes': ['collapse']}),
8
12
    ]
 
13
    inlines = [ChoiceInline]
9
14
 
10
15
admin.site.register(Poll, PollAdmin)
11
 
admin.site.register(Choice)