Re: second query question

2007-08-28 Thread Tim Chase
> class Property(models.Model): > > thing = models.ForeignKey(Thing) > property_type = models.ForeignKey(PropertyType) > value = models.CharField(...) > ... > > I want to find, for a given PropertyType, all the Things that are > lacking any Property of that type. > >

Re: second query question

2007-08-28 Thread r_f_d
I believe it would be: Thing.objects.all().exclude(property__property_type__exact = type).distinct() -rfd On Aug 28, 12:24 pm, James Tauber <[EMAIL PROTECTED]> wrote: > There's another query I want to do that I can't seem to wrap my head > around at the moment: > > Say I have a model where

second query question

2007-08-28 Thread James Tauber
There's another query I want to do that I can't seem to wrap my head around at the moment: Say I have a model where Things have Properties each of a particular PropertyType. So class Property(models.Model): thing = models.ForeignKey(Thing) property_type =