I think, you will also need related_name parameter for your relating fields.
Regards, Aidas Bendoraitis aka Archatas On 1/5/07, Jorge Gajon <[EMAIL PROTECTED]> wrote:
Hi Aljosa, On 1/4/07, Aljosa Mohorovic <[EMAIL PROTECTED]> wrote: > > i'm trying to create a model which referencing itself and for this > code i get this error: > "name 'Chapter' is not defined" > > how do i do this or something similar? > > code: > >>> > from django.db import models > > class Chapter(models.Model): > name = models.CharField(maxlength=200) > content = models.TextField() > prev = models.OneToOneField(Chapter) > next = models.OneToOneField(Chapter) > <<< > Try with: prev = models.OneToOneField('self') next = models.OneToOneField('self') Regards >
--~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---