Hi Everyone

I've posted this to the django-users list, though I realize now that
this is probably better suited for the developers list, since I am
more providing information about the behaviour of the Django Admin and
unicode than asking for help. Any help forhtcoming would be greatly
appreciated, od course.

I am using Django svn, updated 3 days ago. DEFAULT_CHARSET is set to
'utf-8' and the files with unicode characters are all marked -*-
coding: uft8 -*-.

When trying to view a row in one of my models in the admin site (the
data was entered using a newforms view), I get the following
following
error:

UnicodeEncodeError at /admin/forms/foo/1/
'ascii' codec can't encode character u'\xe3' in position 286: ordinal
not in range(128)

Request Method:         GET
Request URL:    http://formularios.inspiro.pt/admin/forms/foo/1/
Exception Type:         UnicodeEncodeError
Exception Value:        'ascii' codec can't encode character u'\xe3'
in
position 286: ordinal not in range(128)
Exception Location:     /usr/lib/python2.3/site-packages/django/
oldforms/
__init__.py in __str__, line 169

Template error

In template /usr/lib/python2.3/site-packages/django/contrib/admin/
templates/widget/default.html, error at line 1

Caught an exception while rendering: 'ascii' codec can't encode
character u'\xe3' in position 286: ordinal not in range(128)

1       {% load admin_modify %}{% output_all bound_field.form_fields
%}

Traceback (innermost last)

/usr/lib/python2.3/site-packages/django/template/__init__.py in
render_node

723.    result = node.render(context)

/usr/lib/python2.3/site-packages/django/template/__init__.py in
render

856.    return func(*resolved_vars)

/usr/lib/python2.3/site-packages/django/contrib/admin/templatetags/
admin_modify.py in output_all

178.    return ''.join([str(f) for f in form_fields])

/usr/lib/python2.3/site-packages/django/oldforms/__init__.py in
__str__

169.    return str(self.formfield.render(self.data))

Now, to correct the problem, I went and swapped 'str' out for
'unicode' in the last two lines of the traceback. This solves the
problem, but creates another.

After the swap, If one tries to save a flatpage containing accented
characters, the same error is reproduced when rendering the following
view on those two lines that were altered, though the flatpage data
will be saved.

Any suggestions? Is the newforms-admin in a usable state?


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

Reply via email to