I got an error when I am using admin interface to submit some forms as
following the Django book (CH6).

When the form in admin interface saving.
Traceback (most recent call last):
File "F:\python25\Lib\site-packages\django-svn\unicode\django\core
\handlers\base.py" in get_response
  77. response = callback(request, *callback_args, **callback_kwargs)
File "F:\python25\Lib\site-packages\django-svn\unicode\django\contrib
\admin\views\decorators.py" in _checklogin
  55. return view_func(request, *args, **kwargs)
File "F:\python25\Lib\site-packages\django-svn\unicode\django\views
\decorators\cache.py" in _wrapped_view_func
  39. response = view_func(request, *args, **kwargs)
File "F:\python25\Lib\site-packages\django-svn\unicode\django\contrib
\admin\views\main.py" in add_stage
  258. LogEntry.objects.log_action(request.user.id,
ContentType.objects.get_for_model(model).id, pk_value,
force_unicode(new_object), ADDITION)
File "F:\python25\Lib\site-packages\django-svn\unicode\django\utils
\encoding.py" in force_unicode
  32. s = unicode(s)

  UnicodeDecodeError at /admin/books/author/add/
  'ascii' codec can't decode byte 0xe4 in position 0: ordinal not in
range(128)

Not sure if that is only my n00b skillz kicking on, it should be a
direct result of the return string as here:

from django.db import models
# ...
class Author(models.Model):
    salutation = models.CharField(maxlength=10)
    first_name = models.CharField(maxlength=30)
    last_name = models.CharField(maxlength=40)
    email = models.EmailField()
    headshot = models.ImageField(upload_to= ('/tmp'))
    class Admin:
        pass

    def __unicode__(self):
        return self.first_name # this string is what I am talking
about

I am using postgresSQL in utf-8 so I thought some non-ascii input
would pass through nicely in the admin interface. But it didn't.
The item would still be saved into the database and viewable in the
admin interface.
After some testing, only the one declared in return clause
(self.first_name in this case) being filled with utf-8 text would
generate this error. If all other fields is filled with utf-8 char and
not the one returned, it would go normally.
And putting "return unicode(self.first_name)" wouldn't help either.

Please have a look to this, and should I repost this as a ticket?

Regards,

Alan


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to