Opened 11 years ago

Closed 11 years ago

#20664 closed Bug (fixed)

[py3] raw_id_fields popup does not return a pk

Reported by: Jeff Triplett 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

Description

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 11 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 by Tim Graham, 11 years ago

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.

by Tim Graham, 11 years ago

Attachment: 20664.diff added

comment:2 by Tim Graham, 11 years ago

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 by loic84, 11 years ago

Triage Stage: AcceptedReady for checkin

LGTM.

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

comment:4 by Simon Charette, 11 years ago

What about using escapejs instead of force_text?

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

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