Code

Opened 8 years ago

Closed 8 years ago

Last modified 8 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
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: UI/UX:

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@…> 8 years ago.
Quick and dirty fix for the problem

Download all attachments as: .zip

Change History (4)

Changed 8 years ago by Christopher Lenz <cmlenz@…>

Quick and dirty fix for the problem

comment:1 Changed 8 years ago by anonymous

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

comment:2 Changed 8 years ago by mtredinnick

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

comment:3 Changed 8 years ago by mtredinnick

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

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.