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
- Django Settings Assignment Expressions aka Walrus Operator example by webology 2 weeks, 5 days ago
- codigo alto nivel by MrRocklion 2 months, 2 weeks ago
- Load template from specific app by Krzysiek555 3 months, 1 week ago
- PostgreSQL JSON subqueries by dolamroth 3 months, 1 week ago
- "Magic Link" Management Command by webology 8 months, 1 week ago