Opened 12 years ago

Closed 12 years ago

#19379 closed Bug (needsinfo)

utf-8 not supported in fieldsets

Reported by: Fernando Adrián Fernández Vargas Owned by: nobody
Component: contrib.admin Version: 1.4
Severity: Normal Keywords: utf-8 fieldsets
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

If you have non-ascii characters in the fieldsets that particular object will not render in the generated template in the django admin.

For example if you use the next code in an admin class the 'General' will render correctly but without it's description. The name 'Información' will not render but its fields will render correctly. Obviously both errors because the special character 'ó' is used (and is really common in Spanish).

    fieldsets = (
        ('General', {
            'fields': ('mat', 'pro', 'per',),
            'description':'cómo'
        }),
        ('Información', {
            'fields': ('f1', 'f2', 'f3',)
        }),
    )

I tried adding the utf-8 codification in every .py file in my project and in the contrib.admin but it did not work.

Change History (1)

comment:1 by Simon Charette, 12 years ago

Resolution: needsinfo
Status: newclosed

Can you paste a traceback of the raised exception?

I guess it's just an issue with unicode literals, can you try prefixing 'cómo' and 'Información' with an u:

fieldsets = (
    ('General', {
        'fields': ('mat', 'pro', 'per',),
        'description': u'cómo'
    }),
    (u'Información', {
        'fields': ('f1', 'f2', 'f3',)
    }),
)

By the way, you should use support channels before reporting such an issue.

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