Recall & Review
beginner
What is the purpose of the <code>ModelAdmin</code> class in Django admin?The <code>ModelAdmin</code> class lets you customize how a model appears and behaves in the Django admin interface, like which fields show, how they are displayed, and what actions are available.Click to reveal answer
beginner
How do you display specific fields in the list view of a Django admin page?
You set the <code>list_display</code> attribute in your <code>ModelAdmin</code> class to a tuple of field names you want to show in the list view.Click to reveal answer
beginner
What does the
search_fields attribute do in a ModelAdmin?It adds a search box to the admin list page that lets users search the specified fields for matching text.
Click to reveal answer
intermediate
How can you group fields in the Django admin form using
ModelAdmin?You use the
fieldsets attribute to group fields into sections with titles, making the form easier to read and organize.Click to reveal answer
beginner
What is the use of the
list_filter attribute in ModelAdmin?It adds filters on the right side of the admin list page so users can quickly filter records by certain fields like dates or categories.
Click to reveal answer
Which
ModelAdmin attribute controls which fields appear in the list view?✗ Incorrect
The
list_display attribute defines the columns shown in the list view of the admin.How do you add a search box to the Django admin list page?
✗ Incorrect
The
search_fields attribute adds a search box to filter records by text.What does the
fieldsets attribute do in ModelAdmin?✗ Incorrect
fieldsets groups form fields into titled sections for better organization.Which attribute adds filters on the right side of the admin list page?
✗ Incorrect
list_filter adds sidebar filters to quickly narrow down records.To customize the admin interface for a model, you should:
✗ Incorrect
You customize admin by creating a
ModelAdmin class and registering it with the model.Explain how to customize the list view of a model in Django admin using
ModelAdmin.Think about what you want to show, filter, and search in the list.
You got /4 concepts.
Describe how to organize fields in the Django admin form with
ModelAdmin.Consider how to make a long form easier to read.
You got /4 concepts.