﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
14591	UnicodeDecodeError when trying to render the label of a field	panosl	nobody	"An error is thrown if you specify a label for a field, ie:

{{{
#!python
from django.db import models
from django.utils.translation import gettext_lazy as _

class MyModel(models.Model):
	name = models.CharField(_('name'), max_length=50)
}}}

If you don't specify a list_display in the admin.py for that model, it will just show all of the fields. This is were this error occurs:

{{{
Caught UnicodeDecodeError while rendering: ('ascii', '\xce\xb3\xcf\x81\xce\xb1\xce\xbc\xce\xbc\xce\xae \xcf\x80\xce\xb1\xcf\x81\xce\xb1\xce\xb3\xce\xb3\xce\xb5\xce\xbb\xce\xb5\xce\xaf\xce\xb1\xcf\x82', 0, 1, 'ordinal not in range(128)')
}}}

A way to fix it is to edit `django.contrib/admin/options.py`, ModelAdmin class, set list_display to `__unicode__`:

{{{
#!python
class ModelAdmin(BaseModelAdmin):
    ""Encapsulates all admin options and functionality for a given model.""

    #list_display = ('__str__',)
    list_display = ('__unicode__',)
}}}

I'm not adding it as a patch right now, not sure if it's the right way to fix it. Maybe we should use force_unicode, but fixing it like above, doesn't seem to break anything."		closed	contrib.admin	1.2		invalid	unicode	rasca7@…	Design decision needed	1	0	1	0	0	0
