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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---