Tuesday, January 25, 2011

Lazy translation (unicode) not working for a CharField in the Admin?

A new and strange error for me...

A model that has a CharField:
comment = models.CharField(max_length=100,db_column='Comment',
blank=True, null=True)
that is defined in a MySQL database:
`Comment` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,

is depicted by the Admin in both the changelist and the editing form as:
<django.utils.functional.__proxy__ object at 0x24fef10>

Other similar fields in other models do not have this "strangeness".
The docs suggest :

"Normally, you won't have to worry about lazy translations. Just be
aware that if you examine an object and it claims to be a
django.utils.functional.__proxy__ object, it is a lazy translation.
Calling unicode() with the lazy translation as the argument will
generate a Unicode string in the current locale."

But I am not sure that this helps in the current situation (and it
also does not explain why this particular model behaves differently
from the others).

Any ideas or insights appreciated.

Derek

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment