About Admin List Filter with Options Limited to Existing Relations
Django provides an ability to show related items in the list filter only if they are connected to this model instances:
from django.contrib import admin
from django.contrib.admin import RelatedOnlyFieldListFilter
from .models import Post
@admin.register(Post)
class PostAdmin(admin.ModelAdmin):
list_filter = [
("categories", RelatedOnlyFieldListFilter),
]
Also by me
Django Paddle Subscriptions app
For Django-based SaaS projects.
Django App for You
Django GDPR Cookie Consent app
For Django websites that use cookies.
Django App for You