#10918 closed (fixed)
to_field and raw_id_fields popup in ModelAdmin
Reported by: | David Cramer | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | 1.1 |
Severity: | Keywords: | raw_id_field, to_field, lookup | |
Cc: | Collin Anderson | 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
When using a to_field on a raw_id_field it fails under the following conditions:
1) Click the hourglass to find a foreign key.
2) Search (or filter)
3) Click the entry.
It inserts the primary key rather than the to_field.
However, if you do not search/filter it works just fine.
The problem seems to be with the fact that t=to_field is not passed on the search/filter.
Attachments (2)
Change History (12)
comment:1 by , 16 years ago
comment:2 by , 16 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:3 by , 15 years ago
Keywords: | raw_id_field to_field lookup added |
---|
I'm experiencing the same issue. The fix dcramer suggests does not work for me - it simply makes selecting the record take you to the add/edit record page as opposed to closing the popup and taking back a value.
comment:4 by , 15 years ago
Needs tests: | set |
---|---|
Patch needs improvement: | set |
Summary: | to_field and raw_id_fields in ModelAdmin → to_field and raw_id_fields popup in ModelAdmin |
Version: | SVN → 1.1 |
I just ran into the same issue. The problem is that TO_FIELD_VAR needs to be removed from the query lookup_params, but not from the params used to construct new urls. I will attach a patch.
comment:5 by , 15 years ago
Patch needs improvement: | unset |
---|
by , 15 years ago
Attachment: | to_field-10918.git.diff added |
---|
Git formated patch that fixes the problem.
comment:6 by , 15 years ago
Cc: | added |
---|
by , 14 years ago
Attachment: | 10918_admin_search_missing_fk_to_field.diff added |
---|
comment:7 by , 14 years ago
Has patch: | set |
---|---|
milestone: | → 1.3 |
Needs tests: | unset |
Triage Stage: | Accepted → Ready for checkin |
Thanks Collin, the patch looks good. I've added a test.
A quick fix (problem doesn't cover all bases) for us was to comment out the following two lines in main.py: