- July 23, 2007
- newforms forms validation clean
- 4 (after 4 ratings)
This is a bit of a hack, but as far as I can see currently the only way to specify a validation error that is specific to a field in form.clean().
I am aware of clean_<fieldname>, but those are difficult to use when the validation process for a field involves other fields as well, because the necessary data might at that point not be yet available in form.cleaned_data.
1 2 3 4 5 6 7 8
def clean(self): try: # do validation here except ValidationError, e: if blame_field: self._errors[blame_field] = e.messages else: raise e
More like this
- Validation for 'unique' and 'unique_together' constraints (different version) by miracle2k 7 years, 8 months ago
- Validator for data by limodou 8 years, 1 month ago
- Changing the look of newforms as_table with a custom BaseForm by bikeshedder 7 years, 10 months ago
- Newforms Validation of Credit Card Numbers by humphreymurray 6 years, 10 months ago
- OpenID Form Field by jpwatts 7 years, 2 months ago