[Django] #35173: DisallowedModelAdminLookup raised when filtering with __isnull on a ForeignKey not listed in list_filters

15 views
Skip to first unread message

Django

unread,
Feb 7, 2024, 5:30:53 AMFeb 7
to django-...@googlegroups.com
#35173: DisallowedModelAdminLookup raised when filtering with __isnull on a
ForeignKey not listed in list_filters
-----------------------------------------+------------------------
Reporter: Stian Jensen | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 5.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
A regression in Django 5.0 was previously reported and fixed, relating to
filtering foreign keys in django-admin in the URL, when not manually
declared in list_filters:
https://code.djangoproject.com/ticket/35087

There is at least one more issue I'm still having, that is still
problematic in Django 5.0.2:

Filtering by whether or not a foreign key value is set also used to work
for any foreign key on the model.
`/admin/core/invoice/?client__isnull=True`

In Django 5.0.2 this provides an error similar to the error reported in
35087.
--
Ticket URL: <https://code.djangoproject.com/ticket/35173>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 8, 2024, 12:12:26 AMFeb 8
to django-...@googlegroups.com
#35173: DisallowedModelAdminLookup raised when filtering with __isnull on a
ForeignKey not listed in list_filters
---------------------------------+------------------------------------

Reporter: Stian Jensen | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 5.0
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by Mariusz Felisiak):

* cc: Sarah Boyce (added)
* type: Uncategorized => Bug
* component: Uncategorized => contrib.admin
* severity: Normal => Release blocker
* stage: Unreviewed => Accepted

Comment:

Thanks for the report.

Regression in f80669d2f5a5f1db9e9b73ca893fefba34f955e7 (Django 5.0.1)
--
Ticket URL: <https://code.djangoproject.com/ticket/35173#comment:1>

Django

unread,
Feb 8, 2024, 7:56:48 AMFeb 8
to django-...@googlegroups.com
#35173: DisallowedModelAdminLookup raised when filtering with __isnull on a
ForeignKey not listed in list_filters
-------------------------------------+-------------------------------------
Reporter: Stian Jensen | Owner: Hisham
| Mahmood
Type: Bug | Status: assigned

Component: contrib.admin | Version: 5.0
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Hisham Mahmood):

* owner: nobody => Hisham Mahmood
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/35173#comment:2>

Django

unread,
Feb 9, 2024, 7:25:35 AMFeb 9
to django-...@googlegroups.com
#35173: DisallowedModelAdminLookup raised when filtering with __isnull on a
ForeignKey not listed in list_filters
-------------------------------------+-------------------------------------
Reporter: Stian Jensen | Owner: Hisham
| Mahmood
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.0
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Hisham Mahmood):

[https://github.com/django/django/pull/17844 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/35173#comment:3>

Django

unread,
Feb 9, 2024, 7:28:50 AMFeb 9
to django-...@googlegroups.com
#35173: DisallowedModelAdminLookup raised when filtering with __isnull on a
ForeignKey not listed in list_filters
-------------------------------------+-------------------------------------
Reporter: Stian Jensen | Owner: Hisham
| Mahmood
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.0
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Hisham Mahmood):

* needs_docs: 0 => 1
* has_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/35173#comment:4>

Django

unread,
Feb 9, 2024, 8:40:13 AMFeb 9
to django-...@googlegroups.com
#35173: DisallowedModelAdminLookup raised when filtering with __isnull on a
ForeignKey not listed in list_filters
-------------------------------------+-------------------------------------
Reporter: Stian Jensen | Owner: Hisham
| Mahmood
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.0
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Hisham Mahmood):

* needs_docs: 1 => 0

--
Ticket URL: <https://code.djangoproject.com/ticket/35173#comment:5>

Django

unread,
Feb 9, 2024, 12:34:17 PMFeb 9
to django-...@googlegroups.com
#35173: DisallowedModelAdminLookup raised when filtering with __isnull on a
ForeignKey not listed in list_filters
-------------------------------------+-------------------------------------
Reporter: Stian Jensen | Owner: Hisham
| Mahmood
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.0
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* needs_better_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/35173#comment:6>

Django

unread,
Feb 11, 2024, 11:58:56 AMFeb 11
to django-...@googlegroups.com
#35173: DisallowedModelAdminLookup raised when filtering with __isnull on a
ForeignKey not listed in list_filters
-------------------------------------+-------------------------------------
Reporter: Stian Jensen | Owner: Hisham
| Mahmood
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.0
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Hisham Mahmood):

* needs_better_patch: 1 => 0

--
Ticket URL: <https://code.djangoproject.com/ticket/35173#comment:7>

Django

unread,
Feb 14, 2024, 8:30:00 PMFeb 14
to django-...@googlegroups.com
#35173: DisallowedModelAdminLookup raised when filtering with __isnull on a
ForeignKey not listed in list_filters
-------------------------------------+-------------------------------------
Reporter: Stian Jensen | Owner: Hisham
| Mahmood
Type: Bug | Status: closed
Component: contrib.admin | Version: 5.0
Severity: Release blocker | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by GitHub <noreply@…>):

* status: assigned => closed
* resolution: => fixed

Comment:

In [changeset:"8db593de05c3516c939b7d4b9eb91e8791f4c79a" 8db593de]:
{{{#!CommitTicketReference repository=""
revision="8db593de05c3516c939b7d4b9eb91e8791f4c79a"
Fixed #35173 -- Fixed ModelAdmin.lookup_allowed() for lookups on foreign
keys when not included in ModelAdmin.list_filter.

Regression in f80669d2f5a5f1db9e9b73ca893fefba34f955e7.

Thanks Sarah Boyce for the review.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35173#comment:8>

Django

unread,
Feb 15, 2024, 6:15:24 AMFeb 15
to django-...@googlegroups.com
#35173: DisallowedModelAdminLookup raised when filtering with __isnull on a
ForeignKey not listed in list_filters
-------------------------------------+-------------------------------------
Reporter: Stian Jensen | Owner: Hisham
| Mahmood
Type: Bug | Status: closed
Component: contrib.admin | Version: 5.0
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/35173#comment:9>

Django

unread,
Feb 15, 2024, 6:19:21 AMFeb 15
to django-...@googlegroups.com
#35173: DisallowedModelAdminLookup raised when filtering with __isnull on a
ForeignKey not listed in list_filters
-------------------------------------+-------------------------------------
Reporter: Stian Jensen | Owner: Hisham
| Mahmood
Type: Bug | Status: closed
Component: contrib.admin | Version: 5.0
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Natalia <124304+nessita@…>):

In [changeset:"3a54e64ef7c14946dd072ddc26666f4ab9551fe0" 3a54e64e]:
{{{#!CommitTicketReference repository=""
revision="3a54e64ef7c14946dd072ddc26666f4ab9551fe0"
[5.0.x] Fixed #35173 -- Fixed ModelAdmin.lookup_allowed() for lookups on


foreign keys when not included in ModelAdmin.list_filter.

Regression in f80669d2f5a5f1db9e9b73ca893fefba34f955e7.

Thanks Sarah Boyce for the review.

Backport of 8db593de05c3516c939b7d4b9eb91e8791f4c79a from main
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35173#comment:10>

Reply all
Reply to author
Forward
0 new messages