class Author(models.Model):
pass
class Book(models.Model):
author = models.ForeignKey(Author, on_delete=models.CASCADE)
And the following admin site:
class AuthorFilter(AutocompleteFilter):
title = _("author")
field_name = "author"
@admin.register(Book)
class BookAdmin(admin.ModelAdmin):
list_filter = (AuthorFilter,)
It's displayed fine but when I run the filter I get the following error:
DisallowedModelAdminLookup at /_admin/app/book/
Filtering by author__pk__exact not allowed
Hi!
I have the following models:
And the following admin site:
It's displayed fine but when I run the filter I get the following error:
Actually, it seems to be a regression in Django 5.0.1: https://github.com/django/django/commit/8db593de05c3516c939b7d4b9eb91e8791f4c79a
It was fixed in Django 5.0.2 but the filter seems to work with
use_pk_exact = False
only: