Opened 14 years ago

Closed 13 years ago

Last modified 13 years ago

#13949 closed (fixed)

readonly fields can't be modified via cleaned_data in forms

Reported by: alk Owned by: elbarto
Component: Documentation Version: 1.2
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Gabriel Hurley)

if you make a model with readonly fields, the value of that field can't be set in a clean() validator in that model's form - this isn't mentioned in the documentation anywhere as far as I can see, should be added I think

Attachments (1)

patch.diff (768 bytes ) - added by elbarto 13 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 by Gabriel Hurley, 14 years ago

Description: modified (diff)
Triage Stage: UnreviewedAccepted

It's true that the data for read-only fields are not available in cleaned_data. This is because read-only fields are displayed as text rather than as input elements, and thus are not posted back to the server, and so are not in the data that gets cleaned.

Mentioning this fact couldn't hurt.

comment:2 by elbarto, 13 years ago

Owner: changed from nobody to elbarto

by elbarto, 13 years ago

Attachment: patch.diff added

comment:3 by elbarto, 13 years ago

Has patch: set

comment:4 by Tim Graham, 13 years ago

Resolution: fixed
Status: newclosed

(In [15060]) Fixed #13949 - Note that readonly fields can't be modified via custom clean methods. thanks alk for the suggestion and elbarto and Gabriel Hurley whose language I used in the final patch.

comment:5 by Tim Graham, 13 years ago

(In [15061]) [1.2.X] Fixed #13949 - Note that readonly fields can't be modified via custom clean methods. thanks alk for the suggestion and elbarto and Gabriel Hurley whose language I used in the final patch.

Backport of r15060 from trunk.

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