Thanks everyone.
Now I have got a clear idea of how these both statements differ to each
other.
Thanks and Regards,
Mahendra
On Tue, Apr 4, 2017 at 5:55 PM, Todor Velichkov
wrote:
> I didn't use anything special, just print on queryset.query
>
> qs1 = Blog.objects.filter(entry__headline__co
f Of Todor Velichkov
Sent: Monday, April 3, 2017 3:06 PM
To: Django users
Subject: Re: filter chaining v/s filter with multiple arguments.
Nope, they are not the same.
The first one:
Blog.objects.filter(entry__headline__contains='Lennon',
entry__pub_date__year=2008)
Will produce the
I didn't use anything special, just print on queryset.query
qs1 = Blog.objects.filter(entry__headline__contains='Lennon',
entry__pub_date__year=2008)
qs2 = Blog.objects.filter(entry__headline__contains='Lennon').filter(
entry__pub_date__year=2008)
print qs1.query
print qs2.query
On Tuesday, Ap
Thanks Todor Velichkov.
It would be great if you let me know how did you get these queries (tool
name etc).
Because when I was trying to get MySQL query using *q.query*, these both
statements were giving same query.
Thanks and Regards,
Mahendra
On Tue, Apr 4, 2017 at 1:35 AM, Todor Velichkov
Nope, they are not the same.
The first one:
Blog.objects.filter(entry__headline__contains='Lennon',
entry__pub_date__year=2008)
Will produce the following SQL:
SELECT
"blog_blog"."id",
"blog_blog"."name",
"blog_blog"."tagline"
FROM
"blog_blog"
INNER JOIN "blog_entry" ON ("bl
this helps.
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On
Behalf Of Mahendra Gaur
Sent: Monday, April 3, 2017 9:42 AM
To: django-users@googlegroups.com
Subject: RE: filter chaining v/s filter with multiple arguments.
Thanks for reply.
I have tried q.query on both statements
*From:* django-users@googlegroups.com [mailto:django-users@googlegroups.com]
*On Behalf Of *Mahendra Gaur
*Sent:* Sunday, April 2, 2017 9:39 AM
*To:* django-users@googlegroups.com
*Subject:* filter chaining v/s filter with multiple arguments.
Hello everyone,
I am newbie to django. Now-a-days am reading
ango-users@googlegroups.com [mailto:django-users@googlegroups.com] On
Behalf Of Mahendra Gaur
Sent: Sunday, April 2, 2017 9:39 AM
To: django-users@googlegroups.com
Subject: filter chaining v/s filter with multiple arguments.
Hello everyone,
I am newbie to django. Now-a-days am reading django d
Thank you for reply.
In case of second statement, why two JOIN are required each with single
filter ?
As per my understanding whether it use one JOIN with both the filter or two
JOIN each with single filter, both are same.
correct me if am wrong ?
Thanks and Regards,
Mahendra
On Mon, Apr 3, 20
The first one will use a single JOIN on the entry table, and will apply
both filters to that table.
The second one will JOIN the entry table twice, and for every join will
apply only a single filter
On Sunday, April 2, 2017 at 5:41:29 PM UTC+3, Mahendra Gaur wrote:
>
> Hello everyone,
>
> I am n
Hello everyone,
I am newbie to django. Now-a-days am reading django docs.
While reading models i got confusion that, What is the difference between
filter chaining and filter with multiple arguments.
For example what is the diffrence between below two:
Blog.objects.filter(entry__headline__contain
11 matches
Mail list logo