list_display (opens in a new tab) determines which fields of models to show on the admin
Let's say we have
User model defined as below:
Then it will display as below.
Or you can also include customized fields by using custom methods based on the fields information.
Below example shows how to print the full name of user combining with his/her
last_name and make them all uppercase.
list_filter (opens in a new tab) reorgnizes the information displayed on
by certain condition that admin user chose.
For instance, we can rearrange the user data table based on
is_admin as below.
search_fields (opens in a new tab) allows us to search fields on
list_display with certain keywords.
Above example shows that admin user can search users by their
icontains (opens in a new tab) feature that searches all results containing certain keywords. However, we can also use
startswith (opens in a new tab) feature by using
^ for searching words that starts only with that keyword.
For fields that are connected by
ManyToManyField, we can search results as below:
search_fields = ["foreign_key__related_fieldname"]