--Hi Mahendra,
You can view the SQL that is generated by using the query attribute on the QuerySet.
q = Blog.objects.filter(entry__headline__contains ='Lennon', entry__pub_date__year=2008)print(str(q.query))
That should help in understanding what is going on.
Best wishes!
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 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__contains ='Lennon', entry__pub_date__year=2008)Blog.objects.filter(entry__headline__contains ='Lennon').filter (entry__pub_date__year=2008 )
can some one please help me to understand how these both works and most importantly what will be corresponding MYSQL queries for above two statements ?
Thanks and Regards,
Mahendra
--
You received this message because you are subscribed to the Google Groups "Django users" group.To view this discussion on the web visit https://groups.google.com/d/
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com .
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users .msgid/django-users/ .CAExdeFaPbedyCOuO_PHsRO3GcVC_ nAMxNm6JCHfsJ%2BCn6bdssg% 40mail.gmail.com
For more options, visit https://groups.google.com/d/optout .You received this message because you are subscribed to the Google Groups "Django users" group.To view this discussion on the web visit https://groups.google.com/d/
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com .
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users .msgid/django-users/ .008b9ec564814285939b4b3cc406bb 14%40ISS1.ISS.LOCAL
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAExdeFb7Zs0vrMKT5m%3DtkPJB1rRboq%2B5FsTKZ9V6%3DqVkWTGZag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment