0

error:

UnicodeDecodeError at /admin/tree/personrol/add/
'ascii' codec can't decode byte 0xd8 in position 1: ordinal not in range(128)

in model:

from django.db import models
class Person(models.Model):
    class Meta:
        verbose_name = u'فرد'
        verbose_name_plural = u'افراد'
    name = models.CharField(max_length=100, verbose_name=u'نام فرد')
    def `__unicode__`(self):
        return self.name

class Rol(models.Model):
    class Meta:
        verbose_name = u'نقش'
        verbose_name_plural = u'نقش ها'
    name = models.CharField(max_length=100, verbose_name=u'نام نقش')
    def `__unicode__`(self):
        return self.name

class PersonRol(models.Model):
    class Meta:
        verbose_name = u'نقش فرد'
        verbose_name_plural = u'نقش افراد'
    person = models.ForeignKey('Person', related_name='person_roles', verbose_name=u'فرد')
    rol = models.ForeignKey('Rol', related_name='person_roles', verbose_name=u'نقش')
    def `__unicode__`(self):
        return '(%s , %s)' % (self.person, self.rol)
2
  • Please post the full traceback. Commented Jul 3, 2014 at 7:15
  • You also dont show which model or data you are saving. Commented Jul 3, 2014 at 7:21

1 Answer 1

3

Try

return u'(%s , %s)' % (self.person, self.rol)
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.