#6705: When using {{ form.errors }} in a template, the output uses field name
instead of using field label.
-------------------------+--------------------------------------------------
Reporter: Emilian | Owner: nobody
Status: reopened | Component: django.newforms
Version: SVN | Resolution:
Keywords: errordict | Stage: Unreviewed
Has_patch: 0 | Needs_docs: 0
Needs_tests: 0 | Needs_better_patch: 0
-------------------------+--------------------------------------------------
Changes (by Emilian):
* status: closed => reopened
* resolution: invalid =>
Comment:
Replying to [comment:2 ubernostrum]:
> The newforms docs explain how to customize error output; meanwhile,
using the field name as the key in the errors dictionary is correct
behavior, because it ensures consistency; using a verbose name or label is
problematic because these may well be translated strings, and so will
change from one page view to the next, wreaking havoc on code which wants
to predictably access specific field errors.
Nobody said that the field name as a key is incorrect behavior or should
be changed in this ticket. The ticket has to do with the fact that you
cannot customize the display for form.errors because all that it contains
is the field name as the key and the messages as the values. If I want to
display all of the errors at the top of the form then it should display
them using a verbose name (label) and not field_name_here.
There's been several IRC members who have observed the same behavior,
expecting that {{ form.errors }} would display a nicely-formatted list of
fields with the errors underneath. Instead they are getting
field_name_here.
I propose having the field name as the key but the value as a dictionary
which has two more keys: "label" and then "errors".
--
Ticket URL: <http://code.djangoproject.com/ticket/6705#comment:3>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---