http://www.djangoproject.com/documentation/model-api/#many-to-one-relationships
class Section(models.Model): parent = models.ForeignKey('self', <---- BAD parent = models.ForeignKey('Section', <---- GOOD -Doug On Mar 26, 6:23 pm, Anderson Santos Silva <[EMAIL PROTECTED]> wrote: > Hello, I am having problem when I use the order_with_respect_to and > a self related foreign key model: > > When I validate this, it raises "'str' object has no attribute > 'get_section_order'" and when I use self or Section, it raises the error: > "Section has no field named 'self'" > > class Section(models.Model): > description = models.CharField(verbose_name='Description',maxlength=100) > parent = models.ForeignKey('self',related_name='childs',blank=True, > null=True) > link = models.CharField(verbose_name="Section link",maxlength=300) > position = models.IntegerField(verbose_name="Order of > appearence",blank=True, null=True) > > def __str__(self): > return self.description > > class Admin: > list_display = ('description','position') > search_fields = ['description'] > > class Meta: > order_with_respect_to = 'parent' > ordering = ['position','description'] --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---