On Thu, Feb 26, 2009 at 2:24 AM, Jesse <[email protected]> wrote:

>
> I have three statements:
> publications = Publication.objects.filter(techpubcombo__technology=t)
> publications2 = Publication.objects.filter(pathpubcombo__pathology=p)
> publications3 = Publication.objects.filter(commpubcombo__commodity=c)
>
> I need to combine the three sets into one set to eliminate duplication
> in the publications and then output the final set to the template.

If am not wrong, the result of first filter is a query object until
you do .all() on it (for ex.) and hence the query object can be
subjected to other filters as well if required. So you should be able
to do one of the following..

[1] publications =
Publication.objects.filter(techpubcombo__technology=t).filter(pathpubcombo__pathology=p).filter(commpubcombo__commodity=c)
[2]  publications = Publication.objects.filter(techpubcombo__technology=t)
 publications = Publication.objects.filter(pathpubcombo__pathology=p)
 publications = Publication.objects.filter(commpubcombo__commodity=c)

both [1] and [2] applies all the three filter conditions on the
Publication.objects and return you the final query object on which you
might be able to do publications.all() and get all the results.


-- 
With Regards,

Parthan "Technofreak" (2FF01026)
http://blog.technofreak.in

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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