23.4.1 Configuring the List Page
In Example 23.19, we start by declaring the UserAdmin
, using the @register()
decorator to associate it with our User
model. We define the list_display
, list_filter
, and search_fields
attributes seen on PostAdmin
.
1 from django.contrib import admin 2 3 from .models import User 4 5 6 @admin.register(User) 7 class UserAdmin(admin.ModelAdmin): 8 # list view 9 list_display = ( 10 'email', 11 'is_staff', 12 'is_superuser') 13 list_filter = ( 14 'is_staff', 15 'is_superuser', 16 'profile--joined') 17 search_fields = ('email',)
In ...
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.