Funny, I just ran into this problem today and got the desired results
by doing:

from django.db.models import Q
from operator import or_
q_list = [Q(title__icontains=k) for k in keywords.split(' ')]
search_results = MyModel.objects.filter(reduce(or_, q_list))

...not that it's a good idea performance-wise to do an icontains like
I'm doing :)

-Eric Florenzano

On Apr 29, 5:00 pm, Luke Plant <[EMAIL PROTECTED]> wrote:
> Hi Malcolm,
>
> After the queryset-refactor merge, code like this breaks:
>
>   Foo.objects.none() | Foo.object.filter(bar=123)
>
> (This kind of thing is useful sometimes when building up a QuerySet in
> stages.  That isn't one of the use cases given for .none() in the
> docs, but the test suite does say "none() returns an EmptyQuerySet
> that behaves like any other QuerySet object", so it would be nice if
> the above worked).
>
> I've created a patch, which special cases EmptyQuerySet in a couple of
> places, which seems to be the simplest way of doing it.  I can commit
> it myself, but I wanted to pass it by you first since I'm unfamiliar
> with qs-rf, and in case you disagree about fixing this -- patch
> attached.
>
> Luke
>
> --
> "Where a person wishes to attract, they should always be ignorant."
> (Jane Austen)
>
> Luke Plant ||http://lukeplant.me.uk/
>
>  EmptyQuerySetMerging.diff
> 2KDownload
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to