from django.contrib import admin

# Register your models here.

from .models import Choice, Question

# stacked: that's lot of space
#class ChoiceInline(admin.StackedInline):
class ChoiceInline(admin.TabularInline):
  model = Choice
  extra = 3

class QuestionAdmin(admin.ModelAdmin):
  # # this way we changed the order
  #fields = ['pub_date', 'question_text']
  # # different organization of fields
  fieldsets = [
    (None,               {'fields': ['question_text']}),
    ('Date information', {'fields': ['pub_date']}),
  ]
  inlines = [ChoiceInline]
  list_display = ('question_text', 'pub_date', 'was_published_recently')
  list_filter = ['pub_date']
  search_fields = ['question_text']

admin.site.register(Question, QuestionAdmin)
