On Sun, 2007-05-27 at 13:34 -0700, itsnotvalid wrote:
> 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)

This suggests that self.first_name hasn't been converted to a unicode
string for some reason and is still a sequence of UTF-8 bytes. That
shouldn't be happening.

> 
> 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.

This is certainly a bit odd and it should be working. I've hammered on
the admin interface quite a bit, saving and loading all kinds of weird
data and so have some other testers. Your model looks like it should be
perfect, too.

I'll have a look at this today when I can make some time.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
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