djangodocs.org

1293 sections across all versions Narrow to Django 6.0 (current) →

How errors are displayed

Reference The Forms API Outputting forms as HTML

If you render a bound Form object, the act of rendering will automatically run the form’s validation if it hasn’t already happened, and the HTML output will include the validation errors as a <ul class="errorlist">.

5.2 6.0

How errors are displayed

Reference The Forms API Outputting forms as HTML

If you render a bound Form object, the act of rendering will automatically run the form’s validation if it hasn’t already happened, and the HTML output will include the validation errors as a <ul class="errorlist"> near the field.

4.2 5.0 5.1

Raising ValidationError

Reference Form and field validation

in tests) that will not vary with translations: Don’t coerce variables into the message; use placeholders and the params argument of the constructor: Use mapping keys instead of positional formatting.

dev

Raising ValidationError

Reference Form and field validation

… coerce variables into the message; use placeholders and the params argument of the constructor: Use mapping keys instead of positional formatting. This enables putting the variables in any order or omitting them altogether when rewriting the message: Wrap the message …

4.2 5.0 5.1 5.2 6.0

ValidationError

Reference Django Exceptions Django Core Exceptions

exceptionValidationError[source] : The ValidationError exception is raised when data fails form or model field validation. For more information about validation, see Form and Field Validation, Model Field Validation and the Validator Reference.

4.2 5.0 5.1 5.2 6.0

ValidationError

Reference Django exceptions

exceptionValidationError[source] : The ValidationError exception is raised when data fails form or model field validation. For more information about validation, see Form and Field Validation, Model Field Validation and the Validator Reference.

dev

Raising multiple errors

Reference Form and field validation

If you detect multiple errors during a cleaning method and wish to signal all of them to the form submitter, it is possible to pass a list of errors to the ValidationError constructor.

dev