Code

Opened 8 months ago

Closed 8 months ago

#21013 closed Uncategorized (fixed)

Admin history should consider ModelAdmin.get_queryset

Reported by: jonash 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

Description

  • 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 jonash 8 months ago.

Download all attachments as: .zip

Change History (8)

Changed 8 months ago by jonash

comment:1 Changed 8 months ago by jonash

  • Component changed from Uncategorized to contrib.admin
  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement set

comment:2 Changed 8 months ago by jcatalan

  • Owner changed from nobody to jcatalan
  • Status changed from new to assigned

comment:3 Changed 8 months ago by jcatalan

  • Triage Stage changed from Unreviewed to Accepted

comment:4 Changed 8 months 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 8 months ago by jcatalan

  • Triage Stage changed from Accepted to Ready 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.

Version 0, edited 8 months ago by jcatalan (next)

comment:6 Changed 8 months ago by jonash

  • Cc jonas-django@… added

comment:7 Changed 8 months ago by Julien Phalip <jphalip@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In 04415bf81b2440a08fc224e6c481bcb5840bbcbc:

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.