Re: Query model with multiple selfs

2011-04-18 Thread o_r
> > Use F() objects: > > >     MyModel.objects.filter(mother=F(top)) Excellent, thanks! Odd-R. -- 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,

Re: Query model with multiple selfs

2011-04-18 Thread Daniel Roseman
On Monday, April 18, 2011 11:57:37 AM UTC+1, Daniel Roseman wrote: > > On Monday, April 18, 2011 9:10:30 AM UTC+1, o_r wrote: >> >> Hello. >> >> I have this model: >> >> class MyModel(models.Model): >> string = models.CharField(max_length=96,unique=True,db_index=True) >> mother=models.F

Re: Query model with multiple selfs

2011-04-18 Thread Daniel Roseman
On Monday, April 18, 2011 9:10:30 AM UTC+1, o_r wrote: > > Hello. > > I have this model: > > class MyModel(models.Model): > string = models.CharField(max_length=96,unique=True,db_index=True) > mother=models.ForeignKey('self',null=True,blank=True) > > top=models.ForeignKey('self',nul

Query model with multiple selfs

2011-04-18 Thread o_r
Hello. I have this model: class MyModel(models.Model): string = models.CharField(max_length=96,unique=True,db_index=True) mother=models.ForeignKey('self',null=True,blank=True) top=models.ForeignKey('self',null=True,blank=True,related_name="Top") I need to make a query which will return