Opened 17 years ago
Closed 17 years ago
#5150 closed (wontfix)
Add validation for unique fields in newforms
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Forms | Version: | dev |
Severity: | Keywords: | unique | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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)
Change History (2)
by , 17 years ago
Attachment: | unique.diff added |
---|
comment:1 by , 17 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
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.