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

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

2017-04-03 Thread Mahendra Gaur
7 at 5:41:29 PM UTC+3, Mahendra Gaur wrote: >> >> 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 argument

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

2017-04-03 Thread Mahendra Gaur
Thanks for reply. I have tried q.query on both statements but both are giving same query. I had tried this even before initiating this mail chain, and this was the point where I got confused. Thanks and regards, Mahendra Gaur On 3 Apr 2017 6:55 p.m., "Matthew Pava" wrote: Hi Mahe

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

2017-04-04 Thread Mahendra Gaur
“Lennon” in the headline. The second >> filter restricts the set of blogs further to those that are also linked to >> entries that were published in 2008. The entries selected by the second >> filter may or may not be the same as the entries in the first filter. We >> are filter

Re: Setting variable in custom template

2017-04-04 Thread Mahendra Gaur
Why do you want to set it in custom template. It would be better if you put this variable in context dictionary while rendering and then use it in the template on the basis of condition. Thanks and regards, Mahendra On 4 Apr 2017 7:44 p.m., "valerio orfano" wrote: > Hi there > > is there any c

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

2017-04-05 Thread Mahendra Gaur
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, April 4, 2017 at 2:03:45 PM UTC+3