El 18/01/10 05:26, Kerrick escribió:
> I'm trying to implement a linked list of abstract objects in my
> models.py; however, it is throwing an error.
> --activenotes/models.py--
> class Element(models.Model):
> class Meta:
> abstract = True
> prev = models.OneToOneField('Element', null=True, blank=True)
> next = models.OneToOneField('Element', null=True, blank=True)
>
> class Text(Element):
> contents = models.TextField()
> --end--
> --output of python manage.py syncdb--
> Error: One or more models did not validate:
> activenotes.text: 'prev' has a relation with model Element, which has
> either not been installed or is abstract.
> activenotes.text: 'next' has a relation with model Element, which has
> either not been installed or is abstract.
> --end--
> How can I rectify the problem?
>
Try using 'self'[0] instead of 'Element', as in:
prev = models.OneToOneField('self', null=True, blank=True)
This will probably fail too. In that case, make sure to use the
related_name[1] option in the field definition.
[0]
http://docs.djangoproject.com/en/1.1/ref/models/fields/#recursive-relationships
[1]
http://docs.djangoproject.com/en/1.1/ref/models/fields/#django.db.models.ForeignKey.related_name
--
Gonzalo Delgado <gonzalo...@gmail.com>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@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.