Thank you for all the suggestions!
Solution 1 - Did not work: pub4=Publication.objects.filter
(techpubcombo__technology=t).filter(pathpubcombo__pathology=p).filter
(commpubcombo__commodity=c)
Solution 1 didn't pull any records
Solution 2 - Did not work:
pub5=Publication.objects.filter(commpubcombo__commodity=c)
pub5=Publication.objects.filter(pathpubcombo__pathology=p)
pub5=Publication.objects.filter(techpubcombo__technology=t)
Solution 2: Grabbed the last selection, overwriting the two previous
selections
Solution 3 - Did work!
for publication in pub1:
if publication not in list:
list.append(publication)
for publication in pub2:
if publication not in list:
list.append(publication)
for publication in pub3:
if publication not in list:
list.append(publication)
My last question! How do I sort the list.append(publication) by
pubtitle?
Thank you!
On Feb 25, 9:24 pm, Parthan SR <[email protected]> wrote:
> 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
-~----------~----~----~----~------~----~------~--~---