Opened 10 years ago

Closed 10 years ago

#3869 closed (worksforme)

newforms form.errors.__all__ cannot render

Reported by: David S. <davidschein@…> Owned by: Adrian Holovaty
Component: Forms Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

If you implement a clean method on your newform and raise a validation error it is keyed on 'all'.

But, {{ form.errors.all }} raises a template error: "Variables and attributes may not begin with underscores: 'form.errors.all'"

Workaround is to put pass the form level errors the template context somewhere, e.g. form_errors=search_form.errors.get('all', None).

Change History (2)

comment:1 Changed 10 years ago by David S. <davidschein@…>

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

Sorry, each underlined all should read more like _ _all_ _.

comment:2 Changed 10 years ago by Adrian Holovaty

Resolution: worksforme
Status: newclosed

Use form.non_field_errors to access the errors that aren't associated with a particular field.

Note: See TracTickets for help on using tickets.
Back to Top