23.3.2 Configuring the Add and Edit Pages

Even though the add and edit pages are different, many of the admin’s options configure both pages. The fieldsets option, for instance, allows us to define which fields are available on the forms in each page and further allow us to organize the fields, as shown in Example 23.10.

Example 23.10: Project Code

blog/admin.py in 478395e75c

 7   class PostAdmin(admin.ModelAdmin):  .       ... 13       # form view 14       fieldsets = ( 15            (None, { 16                'fields': ( 17                     'title', 'slug', 'author', 'text', 18                )}), 19            ('Related', { 20                'fields': ( 21                     'tags', 'startups')}), 22       ) ...

Get Django Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.