Skip to content Skip to sidebar Skip to footer

Add Button Not Showing Up In Django Tutorial 02

I am new to Django and have been going through the official tutorial on www.djangoproject.com. I have successfully implemented the tutorial 1 in my system but I am unable to figure

Solution 1:

First of all, it is unclear why are the classes in the admin.py written inside the string in triple quotes.

Assuming this is a typo/intentional, you still need to register() the PollAdmin:

admin.site.register(Poll, PollAdmin)

The complete code at this step should look like:

from django.contrib import admin
from polls.models import Choice, Poll

classPollAdmin(admin.ModelAdmin):
    fieldsets = [
        (None,               {'fields': ['question']}),
        ('Date information', {'fields': ['pub_date'], 'classes': ['collapse']}),
    ]

admin.site.register(Choice)
admin.site.register(Poll, PollAdmin)

Post a Comment for "Add Button Not Showing Up In Django Tutorial 02"