Skip to content

Instantly share code, notes, and snippets.

@roosnic1
Created July 22, 2020 15:53
Show Gist options
  • Save roosnic1/6e36f557482952b0cbc2c188a25e9812 to your computer and use it in GitHub Desktop.
Save roosnic1/6e36f557482952b0cbc2c188a25e9812 to your computer and use it in GitHub Desktop.
from django.contrib import admin
from .models import Question, Choice
class ChoiceInline(admin.TabularInline):
model = Choice
fields = ('choice_text', 'votes',)
fk_name = "question"
@admin.register(Question)
class QuestionAdmin(admin.ModelAdmin):
list_display = ("question_text","pub_date")
list_filter = ("pub_date",)
search_fields = ("question_text",)
inlines = [ChoiceInline]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment