gremmie@1: ''' gremmie@1: This file contains the automatic admin site definitions for the polls models. gremmie@1: ''' gremmie@1: gremmie@1: from django.contrib import admin gremmie@1: from polls.models import Poll gremmie@1: from polls.models import Choice gremmie@1: gremmie@1: gremmie@1: class ChoiceInline(admin.TabularInline): gremmie@1: model = Choice gremmie@1: extra = 3 bgneal@439: raw_id_fields = ['voters'] gremmie@1: gremmie@1: gremmie@1: class PollAdmin(admin.ModelAdmin): bgneal@439: list_display = ['question', 'start_date', 'end_date', 'is_enabled'] bgneal@439: inlines = [ChoiceInline] bgneal@439: list_filter = ['start_date', 'end_date'] bgneal@439: search_fields = ['question'] gremmie@1: date_hierarchy = 'start_date' gremmie@1: gremmie@1: gremmie@1: admin.site.register(Poll, PollAdmin)