Create your administration models: Filters

  1. Customizing the admin
  2. Create your administration models
  3. Editable fields

That’s already a lot better, but we can make the admin page even more useful. There are three very useful filters that help us quickly focus on the posts we want to see. Below list_display, add:

ordering = ['-changed']

date_hierarchy = 'date'

search_fields = ['title', 'slug']

list_filter = ['author', 'topics', 'live']

The first line sets the default order so that the most recently-edited posts show first. The second adds a date bar across the top that lets you focus in on year, then month, then day. The third adds a search box at the top that lets you search for items. And the fourth adds a column on the far right that lets you choose which author, which topic or which status of posts you want to see.

  1. Customizing the admin
  2. Create your administration models
  3. Editable fields