The reference you want is here:
http://docs.djangoproject.com/en/dev/ref/forms/validation/#form-subclasses-and-modifying-field-errors
Note particularly those first few paragraphs under 'Form subclasses
and modifying field errors', and examples below.
sdc
--~--~-~--~~~--
I think the errors attribute needs to be a list (hence the name), so
try:
form._errors['name'].append('User name already in use')
I think errors is not only a list, but an instance of
django.forms.utils.ErrorList (or any subclass of it), which controls
the way errors are displayed in the form, a
If I have a form and if form.is_valid is False
The code code in the template {{ form.name.errors}} formats the error
like this.
This field is required.
How do you add an error so it gets formatted with the surrounding
html. If a user name already exists I want to add the error message
'User na
3 matches
Mail list logo