Opened 5 years ago

Closed 5 years ago

#20664 closed Bug (fixed)

[py3] raw_id_fields popup does not return a pk

Reported by: jefftriplett Owned by: Tim Graham
Component: contrib.admin Version: 1.5
Severity: Normal Keywords: raw_id_fields, admin
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


The raw_id_fields popup appears to be broken in Django 1.5 (using Python 3). The popup lets you select a record but instead of returning the pk (to fill out the admin form), the popup window instead now goes to the change view and does not return back to the window that opened it. Same behavior in Chrome and Safari.

Attachments (1)

20664.diff (2.0 KB) - added by Tim Graham 5 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 5 years ago by Tim Graham

Owner: changed from nobody to Tim Graham
Status: newassigned
Summary: raw_id_fields popup is not returning a pk[py3] raw_id_fields popup does not return a pk
Triage Stage: UnreviewedAccepted

I can reproduce and am working on a patch.

Changed 5 years ago by Tim Graham

Attachment: 20664.diff added

comment:2 Changed 5 years ago by Tim Graham

Has patch: set

repr() on Python 2 includes a leading u on unicode strings which isn't there on Python 3. I think the repr() call to add apostrophes around the pk in the attached patch can safely be replaced by HTML entities. This was originally added in [f2a45f9b].

comment:3 Changed 5 years ago by loic84

Triage Stage: AcceptedReady for checkin


Eventually, since the admin has the HTML5 doctype, you could replace the ' HTML entity by the more readable '.

comment:4 Changed 5 years ago by Simon Charette

What about using escapejs instead of force_text?

comment:5 Changed 5 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In 534ced5aadf964eca4cf29a689dc70185f582772:

Fixed #20664 -- Fixed a bug with raw_id_fields on Python 3.

Thanks jefftriplett for the report.

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