THANKS!!!!!!!!!!!!!!!! On Mon, Jan 26, 2009 at 10:21 PM, Daniel Roseman < roseman.dan...@googlemail.com> wrote:
> > On Jan 26, 8:08 pm, Oleg Oltar <oltarase...@gmail.com> wrote: > > Hi. > > I want to use django admin, for adding articles into my db. My language > is > > Russian. > > > > I defined model in the following way: > > > > from django.db import models > > from tinymce import models as tinymce_models > > > > class Article(models.Model): > > title = models.CharField(max_length=60) > > body = tinymce_models.HTMLField() > > slug = models.SlugField(unique=True) > > > > def get_absolute_url(self): > > return "/article/%s/" % self.slug > > > > def __str__(self): > > return 'Title: %s' %(self.title) > > > > But when I am trying to add an article from django admin I am getting > > > > UnicodeEncodeError at /admin/visitcard/article/add/ > > > > 'ascii' codec can't encode characters in position 7-13: ordinal not in > > range(128) > > > > How can I encode those fields added from the admin > > Assuming you're using a version of Django greater than 0.96, you > should define __unicode__, not __str__, and ensure that you return a > unicode string from that method. > > def __unicode__(self): > return u'Title: %s' % self.title > > -- > DR. > > > --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---