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: | 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)
Change History (6)
by , 17 years ago
Attachment: | django_admin_search_bug.patch added |
---|
comment:1 by , 17 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
comment:2 by , 16 years ago
Cc: | 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 , 16 years ago
Attachment: | admin_search_queryset.patch added |
---|
comment:3 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → Bug |
comment:4 by , 13 years ago
Easy pickings: | unset |
---|---|
Resolution: | → fixed |
Status: | new → closed |
UI/UX: | unset |
This was fixed at some point.
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.