'ascii' codec can't encode characters in position 0-8: ordinal not in range(128)
| Request Method: | POST |
|---|---|
| Request URL: | http://127.0.0.1:8000/admin/picviewer/menu/add/ |
| Django Version: | 1.2.5 |
| Exception Type: | UnicodeEncodeError |
| Exception 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 43 |
| Python Executable: | D:\install\python27\python.exe |
| Python Version: | 2.7.1 |
| Python 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 |
I fixed this by change the unicode to return self.name - but why was this failing anyway?
--
You received this message because you are subscribed to the Google Groups "Django developers" group.
To post to this group, send email to django-d...@googlegroups.com.
To unsubscribe from this group, send email to django-develop...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
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?