Re: filter chaining v/s filter with multiple arguments.

2017-04-05 Thread Mahendra Gaur
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

RE: filter chaining v/s filter with multiple arguments.

2017-04-04 Thread Matthew Pava
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

Re: filter chaining v/s filter with multiple arguments.

2017-04-04 Thread Todor Velichkov
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

Re: filter chaining v/s filter with multiple arguments.

2017-04-04 Thread Mahendra Gaur
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

Re: filter chaining v/s filter with multiple arguments.

2017-04-03 Thread 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

RE: filter chaining v/s filter with multiple arguments.

2017-04-03 Thread Matthew Pava
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

RE: filter chaining v/s filter with multiple arguments.

2017-04-03 Thread Mahendra Gaur
*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

RE: filter chaining v/s filter with multiple arguments.

2017-04-03 Thread Matthew Pava
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

Re: filter chaining v/s filter with multiple arguments.

2017-04-03 Thread Mahendra Gaur
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

Re: filter chaining v/s filter with multiple arguments.

2017-04-03 Thread Todor Velichkov
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

filter chaining v/s filter with multiple arguments.

2017-04-02 Thread Mahendra Gaur
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