23.4.2 Configuring the Add and Edit Pages
We can use the fieldsets
attribute to take control of the output of the forms in both the add and edit pages of our admin, as shown in Example 23.24.
7 class UserAdmin(admin.ModelAdmin): . ... 22 # form view 23 fieldsets = ( 24 (None, {'fields': ('email', 'password')}), 25 ('Permissions', { 26 'fields': ( 27 'is_active', 28 'is_staff', 29 'is_superuser', 30 'groups', 31 'user_permissions')}), 32 ('Important dates', { 33 'fields' : (
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.