Skip to content

Latest commit

 

History

History
18 lines (11 loc) · 556 Bytes

File metadata and controls

18 lines (11 loc) · 556 Bytes

Adding filtering functionality to the Django Admin

To add the ability to filter to the Django admin, enable the list_filter attribute and use the field name as it is:

from django.contrib import admin
from fics.models import Author, Character, CustomTag, Fandom, Fic, Ship


class CharacterAdmin(admin.ModelAdmin):
    ...
    list_filter = ("fandom",)

Result:

Screen Shot 2022-11-16 at 9 04 16 AM