I created a simple model:

class Menu(models.Model):
    name = models.CharField(null=False, 
blank=False,unique=True,max_length=50)
    url = models.CharField(null=False, blank=False, 
unique=True,max_length=100)
    sortOrder = models.IntegerField(null=False, blank=False, default=0)
    def __unicode__(self):
        return 'name: {0}, url: {1}'.format(self.name, self.url)

and hooked it to admin (all running on windows 7, django dev server)

now when I add a new item via admin and the name is in Russian (Like 
"коллекция картинок") it throws the following exception. How do I fix this?

UnicodeEncodeError at /admin/picviewer/menu/add/

'ascii' codec can't encode characters in position 0-8: ordinal not in range(128)

Request Method:POSTRequest URL:
http://127.0.0.1:8000/admin/picviewer/menu/add/Django Version:1.2.5Exception 
Type:UnicodeEncodeErrorException Value:

'ascii' codec can't encode characters in position 0-8: ordinal not in range(128)

Exception Location:D:\~Sasha\www.zavalen.ru\django\zavalen\picviewer\models.py 
in __unicode__, line 43Python Executable:D:\install\python27\python.exePython 
Version:2.7.1Python Path:['D:\\~Sasha\\www.zavalen.ru\\django\\zavalen', 
'C:\\Windows\\system32\\python27.zip', 'D:\\install\\python27\\DLLs', 
'D:\\install\\python27\\lib', 'D:\\install\\python27\\lib\\plat-win', 
'D:\\install\\python27\\lib\\lib-tk', 'D:\\install\\python27', 
'D:\\install\\python27\\lib\\site-packages']Server time:Tue, 22 Feb 2011 
23:24:58 +0300

-- 
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 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to