from django.contrib import admin

# Register your models here.
from .models import Question



class QuestionAdmin(admin.ModelAdmin):
    fields = ['pub_date', 'question_text']

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

# Register your models here.
from .models import Question


class QuestionAdmin(admin.ModelAdmin):

    #fields = ['pub_date', 'question_text']

    fieldsets = [
        (None, {'fields' : ['question_text']}),
        ('Date Information', { 'fields' : ['pub_date'], 'classes': ['collapse']}),
    ]

admin.site.register(Question, QuestionAdmin)
Put Question Admin fields in a fieldset and added a collapse class to the date field
Put Question Admin fields in a fieldset and added a collapse class to the date field

  from django.contrib import admin
  
  # Register your models here.
  from .models import Question
  
  
+ class QuestionAdmin(admin.ModelAdmin):
  
- class QuestionAdmin(admin.ModelAdmin):
-     fields = ['pub_date', 'question_text']
+     #fields = ['pub_date', 'question_text']
+ 
+     fieldsets = [
+         (None, {'fields' : ['question_text']}),
+         ('Date Information', { 'fields' : ['pub_date'], 'classes': ['collapse']}),
+     ]
  
  admin.site.register(Question, QuestionAdmin)
Put Question Admin fields in a fieldset and added a collapse class to the date field
## Code Before:
from django.contrib import admin

# Register your models here.
from .models import Question



class QuestionAdmin(admin.ModelAdmin):
    fields = ['pub_date', 'question_text']

admin.site.register(Question, QuestionAdmin)
## Instruction:
Put Question Admin fields in a fieldset and added a collapse class to the date field
## Code After:
from django.contrib import admin

# Register your models here.
from .models import Question


class QuestionAdmin(admin.ModelAdmin):

    #fields = ['pub_date', 'question_text']

    fieldsets = [
        (None, {'fields' : ['question_text']}),
        ('Date Information', { 'fields' : ['pub_date'], 'classes': ['collapse']}),
    ]

admin.site.register(Question, QuestionAdmin)