Opened 11 months ago

Closed 10 months ago

Last modified 10 months ago

#35173 closed Bug (fixed)

DisallowedModelAdminLookup raised when filtering with __isnull on a ForeignKey not listed in list_filters

Reported by: Stian Jensen Owned by: Hisham Mahmood
Component: contrib.admin Version: 5.0
Severity: Release blocker Keywords:
Cc: Sarah Boyce Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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.

Change History (10)

comment:1 by Mariusz Felisiak, 11 months ago

Cc: Sarah Boyce added
Component: Uncategorizedcontrib.admin
Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted
Type: UncategorizedBug

Thanks for the report.

Regression in f80669d2f5a5f1db9e9b73ca893fefba34f955e7 (Django 5.0.1)

comment:2 by Hisham Mahmood, 11 months ago

Owner: changed from nobody to Hisham Mahmood
Status: newassigned

comment:3 by Hisham Mahmood, 11 months ago

comment:4 by Hisham Mahmood, 11 months ago

Has patch: set
Needs documentation: set

comment:5 by Hisham Mahmood, 11 months ago

Needs documentation: unset

comment:6 by Natalia Bidart, 11 months ago

Patch needs improvement: set

comment:7 by Hisham Mahmood, 10 months ago

Patch needs improvement: unset

comment:8 by GitHub <noreply@…>, 10 months ago

Resolution: fixed
Status: assignedclosed

In 8db593de:

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.

comment:9 by Natalia Bidart, 10 months ago

Triage Stage: AcceptedReady for checkin

comment:10 by Natalia <124304+nessita@…>, 10 months ago

In 3a54e64e:

[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

Note: See TracTickets for help on using tickets.
Back to Top