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
> > AttributeError: 'QuerySet' object has no attribute 'header_set'
>
> The results (which you store in "d") are a QuerySet which is a
> collection of Details.  Each Detail within that set has a
> header_set property.  Thus it would make sense to do something like
>
>    for thing in d:
>      for header in thing.header_set:
>        do_something(header)
>
> Or, if you want the headers, ask for them, not the details:
>
>    since = datetime.date(2007,6,1)
>    headers = Headers.objects.filter(
>      code='123',
>      author='dave',
>      header__creation_date__gte=since # (*)
>      )
>    for header in headers:
>      do_something(header)
>
> The line marked with (*) may be what you're looking for.
>
> -tim


--~--~---------~--~----~------------~-------~--~----~
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, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to