November 2015
Beginner to intermediate
840 pages
26h 30m
English
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.
Example 23.19: Project Code
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 ...
Read now
Unlock full access