Re: Problem with query over relationships and the FOO_set Manager

2007-06-25 Thread ilDave
I tried your second solution and it works fine! Thanks! On Jun 25, 4:51 pm, Tim Chase <[EMAIL PROTECTED]> wrote: > > d = Details.objects.filter(creation_date__gte=datetime.date(2007, 06, > > 01)) > > d = d.header_set.filter(code__exact='123', author__exact='dave') > > > but I get an > >

Re: Problem with query over relationships and the FOO_set Manager

2007-06-25 Thread Tim Chase
Whoops...though I hate responding to my own post, I got things backwards somehow (swapping details and headers). Your Details have the header attribute so you want since = datetime.date(2007,6,1) details = Details.objects.filter( code='123', author='dave',

Re: Problem with query over relationships and the FOO_set Manager

2007-06-25 Thread James Bennett
On 6/25/07, ilDave <[EMAIL PROTECTED]> wrote: > So, I looked in the documentation and I found the 'FOO_set' Manager, > and I tried something like this: > > d = Details.objects.filter(creation_date__gte=datetime.date(2007, 06, > 01)) > d = d.header_set.filter(code__exact='123',

Re: Problem with query over relationships and the FOO_set Manager

2007-06-25 Thread Tim Chase
> d = Details.objects.filter(creation_date__gte=datetime.date(2007, 06, > 01)) > d = d.header_set.filter(code__exact='123', author__exact='dave') > > but I get an > AttributeError: 'QuerySet' object has no attribute 'header_set' The results (which you store in "d") are a QuerySet which is a

Problem with query over relationships and the FOO_set Manager

2007-06-25 Thread ilDave
In my app I have two models like this: class Header(models.Model): code = models.CharField() author = models.CharField() class Detail(models.Model) header = models.ForeignKey(Header) creation_date = models.DateTime() I need to find all the Header objects with a certain code, a