Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#13583 closed (invalid)

Invalid localization of error_messages in form fields

Reported by: dmitry_nosov Owned by: nobody
Component: Core (Other) Version: 1.2
Severity: Keywords: error_messages
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Karen Tracey)

If I use this construction:

forms.IntegerField(min_value=1, max_value=5,                                   
                                 error_messages = {
                                    'max_value': u'Ошибка!',

The error message output is

Instead of


Change History (3)

comment:1 Changed 12 years ago by Gregor Müllegger

I cannot confirm this.
The following code generates the expected output:

class A(forms.Form):
    value = forms.IntegerField(min_value=1, max_value=10,
    error_messages = {
        'max_value': u'Ошибка!',

print A({'value':'12'}).errors['value'][0]



Your confusion might be resulting of python's behaviour how unicode strings are handled. If you use a character like б in a string it will be converted into its unicode number which is \u0431 in this case.

comment:2 Changed 12 years ago by Karen Tracey

Description: modified (diff)
Resolution: invalid
Status: newclosed

There is not enough information here to figure out what's going on....the error message output where? In a template, the snippet provided does produce correct output by default (for example if {{ form }} is used in the template for display). I suspect the observed problem is due to some incorrect way of outputting the error information in the template, or, if the "output" being referred to is some debugging information, then a misunderstanding about how Python displays unicode string representations (as phxx notes), not a bug in Django. A better place to ask for help in either case would be django-users.

comment:3 Changed 11 years ago by Jacob

milestone: 1.2

Milestone 1.2 deleted

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