Hi, I know the Q way, but actually the filter contains already a lot of Qs.
I am looking for a way to combine "a" and "b" without going into their filters. Thanks Jacob Kaplan-Moss wrote: > On 12/10/06 9:37 PM, Rares Vernica wrote: >> What is a way to get the union of two QuerySets? > > See > http://www.djangoproject.com/documentation/db_api/#complex-lookups-with-q-objects. > >> In [6]: a = Person.objects.filter(first_name__startswith='mic') >> >> In [7]: b = Person.objects.filter(first_name__startswith='joh') > > Try:: > > >>> Person.objects.filter( > ... Q(first_name__startswith="mic") | > ... Q(first_name__startswit="joh") > ... ) > > Jacob > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

