models.Q(first_**name__startswith='joh'))
> (only one query...)
>
>
> 2012/8/1 Robin Pedersen <robinpe...@gmail.com>
>
>> On Monday, December 11, 2006 4:37:25 AM UTC+1, Rares Vernica wrote:
>>>
>>> Hi,
>>>
>>> What is
On 1 elo, 19:15, Tim Chase wrote:
> On 08/01/12 10:28, lex P rez wrote:
>
> > Hi,
>
> > it's better Person.objects.filter(models.Q(first_**name__startswith='mic'),
> > models.Q(first_**name__startswith='joh'))
> > (only one query...)
>
> I'm pretty sure this will
On 08/01/12 10:28, Àlex Pérez wrote:
> Hi,
>
> it's better Person.objects.filter(models.Q(first_**name__startswith='mic'),
> models.Q(first_**name__startswith='joh'))
> (only one query...)
I'm pretty sure this will get you the intersection (it uses AND)
rather than the union (which would be
,
>>
>> What is a way to get the union of two QuerySets?
>>
>> Something like:
>>
>> In [6]: a = Person.objects.filter(first_**name__startswith='mic')
>>
>> In [7]: b = Person.objects.filter(first_**name__startswith='joh')
>>
>> In [8]:
On Monday, December 11, 2006 4:37:25 AM UTC+1, Rares Vernica wrote:
>
> Hi,
>
> What is a way to get the union of two QuerySets?
>
> Something like:
>
> In [6]: a = Person.objects.filter(first_name__startswith='mic')
>
> In [7]: b = Person.objects.filter(first_nam
Yes you can do a union. Use the "|" (pipe) operator.
union = queryset1 | queryset2
or you can replace queryset1 with the union as follows:
queryset1 |= queryset2
Nick
On 16/02/10 02:39, rebus_ wrote:
On 16 February 2010 03:28, ydjango wrote:
I have two query sets
On 16 February 2010 03:28, ydjango wrote:
> I have two query sets with two different where clauses on same table
> and same columns in select. Is it possible to have their union.
>
> I tried qryset = qryset1 + qryset2
> It gave me - "+ unsupported operand"
>
> --
> You
I have two query sets with two different where clauses on same table
and same columns in select. Is it possible to have their union.
I tried qryset = qryset1 + qryset2
It gave me - "+ unsupported operand"
--
You received this message because you are subscribed to the Google Groups
"Django
if you want a true union, use chain from itertools on the two querysets...
On 12/11/06, Jeremy Dunck <[EMAIL PROTECTED]> wrote:
>
> On 12/11/06, Rares Vernica <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> >
> > I know the Q way, but actually the filter contains already a lot of Qs.
> >
> > I am
On 12/11/06, Rares Vernica <[EMAIL PROTECTED]> wrote:
>
> 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.
QuerySets are lazy. There's no downside to combining two
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 uni
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.ob
12 matches
Mail list logo