Opened 11 years ago

Closed 11 years ago

#5150 closed (wontfix)

Add validation for unique fields in newforms

Reported by: ctdecci@… Owned by: Adrian Holovaty
Component: Forms Version: master
Severity: Keywords: unique
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


Add validation for unique fields in newforms. The attached file may be a valid patch for this. It adds a clean_% method to the class created by form_for_model/form_for_instance. In form_for_model, it also adds the default field value as the initial value in the field (sorry for the piggybacking).

Attachments (1)

unique.diff (3.4 KB) - added by ctdecci@… 11 years ago.

Download all attachments as: .zip

Change History (2)

Changed 11 years ago by ctdecci@…

Attachment: unique.diff added

comment:1 Changed 11 years ago by Malcolm Tredinnick

Resolution: wontfix
Status: newclosed

This is trying to do model validation in the form. Instead of this, Jacob is in the process of fixing up the missing pieces of model validation so that it works more smoothly. Then errors like this will be generated as part of calling Model.validate() and can be passed back to the form re-presentation.

So, thanks for the patch, but I think we'll pass on this approach in favour of the doing the validation in the more appropriate place (it's model related, so should be done in the model). Those changes are work-in-progress at the moment.

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