Opened 17 years ago

Closed 13 years ago

#5970 closed Bug (fixed)

ChangeList.get_query_set() method ignores specified by model's admin manager QuerySet for search_fields lookup

Reported by: Nazar <911.17@…> Owned by: nobody
Component: contrib.admin Version: dev
Severity: Normal Keywords: search_fields
Cc: gregoire@… Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

I use custom QuerySet for my model. It is returned by specified in admin options custom manager. When I used search box in change list to search some data I noticed that resulting QuerySet is not my custom QuerySet. As I could see later in admin contrib code - that's because searching method creates own QuerySet instead of using admin manager for this.

Attachments (2)

django_admin_search_bug.patch (770 bytes ) - added by Nazar <911.17@…> 17 years ago.
admin_search_queryset.patch (720 bytes ) - added by gregoire 16 years ago.

Download all attachments as: .zip

Change History (6)

by Nazar <911.17@…>, 17 years ago

comment:1 by MichaelBishop, 17 years ago

Triage Stage: UnreviewedDesign decision needed

This patch is a one line modification which appears reasonable and very straight forward. The same "bug" appears in NFA (line 328, r7266) as well. The patch needs to be tested.

comment:2 by gregoire, 16 years ago

Cc: gregoire@… added
Patch needs improvement: set

I have the same problem in the current SVN.

I use the patch admin_search_queryset.patch, but it needs to clone the QuerySet using the private method _clone() because of the dup_select_related() call, which is not very clean.

by gregoire, 16 years ago

Attachment: admin_search_queryset.patch added

comment:3 by Gabriel Hurley, 14 years ago

Severity: Normal
Type: Bug

comment:4 by Alex Gaynor, 13 years ago

Easy pickings: unset
Resolution: fixed
Status: newclosed
UI/UX: unset

This was fixed at some point.

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