来来去去
分类: Python/Ruby
2010-05-06 22:11:24
Edit admin.py to make these changes:
|
We created the class AuthorAdmin. This class, which subclasses django.contrib.admin.ModelAdmin, holds custom configuration for a specific admin model. We’ve only specified one customization — list_display, which is set to a tuple of field names to display on the change list page. These field names must exist in the model, of course.
We altered the admin.site.register() call to add AuthorAdmin after Author. You can read this as: “Register the Author model with the AuthorAdmin options.”
The admin.site.register() function takes a ModelAdmin subclass as an optional second argument. If you don’t specify a second argument (as is the case for Publisher and Book), Django will use the default admin options for that model.