#20664 closed Bug (fixed)

[py3] raw_id_fields popup does not return a pk

Reported by: jefftriplett Owned by: timo
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 timo 20 months ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 20 months ago by timo

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to timo
  • Patch needs improvement unset
  • Status changed from new to assigned
  • Summary changed from raw_id_fields popup is not returning a pk to [py3] raw_id_fields popup does not return a pk
  • Triage Stage changed from Unreviewed to Accepted

I can reproduce and am working on a patch.

Changed 20 months ago by timo

comment:2 Changed 20 months ago by timo

  • 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 20 months ago by loic84

  • Triage Stage changed from Accepted to Ready for checkin

LGTM.

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

comment:4 Changed 20 months ago by charettes

What about using escapejs instead of force_text?

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

  • Resolution set to fixed
  • Status changed from assigned to closed

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