Code

Opened 7 years ago

Closed 7 years ago

#3869 closed (worksforme)

newforms form.errors.__all__ cannot render

Reported by: David S. <davidschein@…> Owned by: adrian
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).

Attachments (0)

Change History (2)

comment:1 Changed 7 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 7 years ago by adrian

  • Resolution set to worksforme
  • Status changed from new to closed

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.