Re: Relating model to itself.

2007-10-16 Thread James Bennett
On 10/16/07, Dmitriy Sodrianov <[EMAIL PROTECTED]> wrote: > As it can be seen from the code above, i want some tasks to have > parent, and a parent must be a task too. The Django documentation covers this. http://www.djangoproject.com/documentation/model-api/#many-to-one-relationships http://www

Re: Relating model to itself.

2007-10-16 Thread George Vilches
Dmitriy Sodrianov wrote: > Hi to all! > > Can anyone help me, why none of the following code works: > > class Task(models.Model): > parent = models.ForeignKey(Task) > > Try: class Task(models.Model): parent = models.ForeignKey('Task') It will do the lookup lat

Relating model to itself.

2007-10-16 Thread Dmitriy Sodrianov
Hi to all! Can anyone help me, why none of the following code works: class Task(models.Model): parent = models.ForeignKey(Task) class Task(models.Model): parent = models.ForeignKey(self) As it can be seen from the code above, i want some tasks to have parent, and a