class SentenceText(models.Model): language = models.ForeignKey(Language) text_id = models.IntegerField() text = models.TextField() def __unicode__(self): return self.id + ' ' + self.text
class Box(models.Model): label = models.ForeignKey(SentenceText, to_field='text_id', related_name='%(class)s_related_label') description = models.ForeignKey(SentenceText, to_field='text_id', related_name='%(class)s_related_description') def __unicode__(self): return self.label ============================ I've got a strange error and in many hour, I haven't manage to fix it. In the Box class, I have 2 ForeignKey to SentenceText because I want for example the same label (or description) in french or in english. But when I try to show a Box list (in admin panel) or a Box detail, I've got this error : "Caught an exception while rendering: coercing to Unicode: need string or buffer, SentenceText found" I need help --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---