Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#2599 closed defect (fixed)

[PATCH] raw_id_admin field has incorrect value in admin form after validation errors

Reported by: Christopher Lenz <cmlenz@…> Owned by: Adrian Holovaty
Component: contrib.admin Version: 0.95
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I'm not sure what this is all about, I'm I was having the following problem:

In the admin for an object that has a raw_id_admin field, when opening an object for editing, the value of the text input is correct: a comma-separated list of IDs:

  <input type="text" value="1,2,3" ... />

However, when saving the object but getting validation errors, the form field suddenly contains the repr of the equivalent Python list in the value attribute:

  <input type="text" value="[&#39;1&#39;, &#39;2&#39;, &#39;3&#39;]" ... />

I'll attach a patch that fixes this, but I'm really not sure where the actual problem is, and where it should be ideally fixed.

Attachments (1)

django_2599.diff (773 bytes ) - added by Christopher Lenz <cmlenz@…> 18 years ago.
Quick and dirty fix for the problem

Download all attachments as: .zip

Change History (4)

by Christopher Lenz <cmlenz@…>, 18 years ago

Attachment: django_2599.diff added

Quick and dirty fix for the problem

comment:1 by anonymous, 18 years ago

How do I replicate this problem? Is it a matter of creating a custom form manipulator and model?

comment:2 by Malcolm Tredinnick, 18 years ago

The patch looks correct and I think you are fixing the problem in the right place, don't worry.

comment:3 by Malcolm Tredinnick, 18 years ago

Resolution: fixed
Status: newclosed

(In [3804]) Fixed #2599 -- Fixed rendering problem in comma-separated integer fields.
Thanks, Christopher Lenz.

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