from django.contrib import admin
from .models import Choice, Question

# Register your models here.
class QuestionAdmin(admin.ModelAdmin):
    fieldsets = [
        (None,               {'fields': ['question_text']}),
        ('Date information', {'fields': ['pub_date']}),
    ]

admin.site.register(Question, QuestionAdmin)
admin.site.register(Choice)
from django.contrib import admin
from .models import Choice, Question

# Register your models here.

class ChoiceInline(admin.StackedInline):
    model = Choice
    extra = 3

class QuestionAdmin(admin.ModelAdmin):
    fieldsets = [
        (None,               {'fields': ['question_text']}),
        ('Date information', {'fields': ['pub_date']}),
    ]
    inlines = [ChoiceInline]

admin.site.register(Question, QuestionAdmin)

Make Choice object editable on Question Admin page
Make Choice object editable on Question Admin page

  from django.contrib import admin
  from .models import Choice, Question
  
  # Register your models here.
+ 
+ class ChoiceInline(admin.StackedInline):
+     model = Choice
+     extra = 3
+ 
  class QuestionAdmin(admin.ModelAdmin):
      fieldsets = [
          (None,               {'fields': ['question_text']}),
          ('Date information', {'fields': ['pub_date']}),
      ]
+     inlines = [ChoiceInline]
  
  admin.site.register(Question, QuestionAdmin)
- admin.site.register(Choice)
+ 
Make Choice object editable on Question Admin page
## Code Before:
from django.contrib import admin
from .models import Choice, Question

# Register your models here.
class QuestionAdmin(admin.ModelAdmin):
    fieldsets = [
        (None,               {'fields': ['question_text']}),
        ('Date information', {'fields': ['pub_date']}),
    ]

admin.site.register(Question, QuestionAdmin)
admin.site.register(Choice)
## Instruction:
Make Choice object editable on Question Admin page
## Code After:
from django.contrib import admin
from .models import Choice, Question

# Register your models here.

class ChoiceInline(admin.StackedInline):
    model = Choice
    extra = 3

class QuestionAdmin(admin.ModelAdmin):
    fieldsets = [
        (None,               {'fields': ['question_text']}),
        ('Date information', {'fields': ['pub_date']}),
    ]
    inlines = [ChoiceInline]

admin.site.register(Question, QuestionAdmin)
