Opened 3 years ago

Closed 3 years ago

#21013 closed Uncategorized (fixed)

Admin history should consider ModelAdmin.get_queryset

Reported by: Jonas H. Owned by: jcatalan
Component: contrib.admin Version: 1.5
Severity: Normal Keywords:
Cc: jonas-django@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no


  • Model with custom default manager that excludes some objects
  • ModelAdmin with custom get_queryset that includes more objects than the manager
  • History view throws 404 for any objects that aren't included the default manager because it doesn't consider the ModelAdmin's get_queryset method.

Test an fix attached. Tests are probably in the wrong place and need to be moved.

Attachments (1)

admin-history-get_queryset-1.diff (5.0 KB) - added by Jonas H. 3 years ago.

Download all attachments as: .zip

Change History (8)

Changed 3 years ago by Jonas H.

comment:1 Changed 3 years ago by Jonas H.

Component: Uncategorizedcontrib.admin
Has patch: set
Needs documentation: unset
Needs tests: unset
Patch needs improvement: set

comment:2 Changed 3 years ago by jcatalan

Owner: changed from nobody to jcatalan
Status: newassigned

comment:3 Changed 3 years ago by jcatalan

Triage Stage: UnreviewedAccepted

comment:4 Changed 3 years ago by jcatalan

I've checked the test and the patch and everything seems to be right. I'll submit a PR and see if I can get some code review by a core dev.

comment:5 Changed 3 years ago by jcatalan

Triage Stage: AcceptedReady for checkin

I've submited a PR with your patch, so I'm changing this to Ready for checkin though I still have to check if the test case is well located or change it in case it's not.

Last edited 3 years ago by jcatalan (previous) (diff)

comment:6 Changed 3 years ago by Jonas H.

Cc: jonas-django@… added

comment:7 Changed 3 years ago by Julien Phalip <jphalip@…>

Resolution: fixed
Status: assignedclosed

In 04415bf81b2440a08fc224e6c481bcb5840bbcbc:

Fixed #21013 -- Ensure that ModelAdmin.get_queryset is considered for the admin history view.

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