Code

#19379 closed Bug (needsinfo)

utf-8 not supported in fieldsets

Reported by: adrianfernandof 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.

Attachments (0)

Change History (1)

comment:1 Changed 17 months ago by charettes

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to needsinfo
  • Status changed from new to closed

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.

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.