Hi Lewis,

  looks like you already got the answer - using Q() objects helps a lot.
I'll just add two things that might help:

  - it's possible to prepare filters in advance which helps readability and
code structure. I often do something similar to this:

from django.db.models import Q
filters = []
# search for tags
filters.append(tag='sometag')
# handle item title
filters.append(title__icontains='someword')
# only list active users
filters.append(is_active=True)

found = Resources.objects.filter(*filters)

  - you might also want to check out for existing solutions if your case
allows. I've recently switched most of my search functionality to
django-watson and would not go back. There are other solutions avaliable of
course, varying in complexity and capabilities.

  Cheers

     Jirka


On 9 January 2014 13:18, Erik Cederstrand <erik+li...@cederstrand.dk> wrote:

> Den 09/01/2014 kl. 08.29 skrev Rodney Lewis <pyrod...@gmail.com>:
>
> > Please help with my question I posted to StackOverflow:
> >
> >
> http://stackoverflow.com/questions/21013973/how-to-combine-multiple-querysets-and-remove-duplicates
>
> If the answer you got there doesn’t solve your problem, then please add a
> comment on SO describing why.
>
> Erik
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0D4BD660-FF97-44C2-9541-19CE66636D1B%40cederstrand.dk
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFhEBEDJNpdkmQcFcRCDNoznMi_HG1H1Dj9rsCKdTdAr%2BFTXHA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to