Instead of letting the admin app generate
PostAdmin for us through a call to
site.register(), we can instead use the
@register() decorator on a subclass of
ModelAdmin, allowing us to configure the set of admin pages using expected attributes. To begin, we can set the
list_display attribute, defining which fields in
PostAdmin we want displayed, as shown in Example 23.6. Figure 23.6 shows the result of this change.
6 @admin.register(Post) 7 class PostAdmin(admin.ModelAdmin): 8 list_display = ('title', 'pub_date')
This change has no effect on the add page, shown in ...