Re: Query spanning two foreign keys

2008-11-16 Thread Will McCutchen
On Nov 15, 7:55 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > This should do the job: > >         User.objects.filter(posts__parent__pk=1).distinct() That does the trick. Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Re: Query spanning two foreign keys

2008-11-15 Thread Malcolm Tredinnick
On Sat, 2008-11-15 at 17:09 -0800, Will McCutchen wrote: > Hi all, > > I've got the following models (simplified for this example): > > from django.db import models > from django.contrib.auth.models import User > > class Chat(models.Model): > name = models.CharField(max_length=256) > >

Query spanning two foreign keys

2008-11-15 Thread Will McCutchen
Hi all, I've got the following models (simplified for this example): from django.db import models from django.contrib.auth.models import User class Chat(models.Model): name = models.CharField(max_length=256) class Post(models.Model): user = models.ForeignKey(User,