From 22cfb84d4fad4e7816008afcc3bea9feb42f08a1 Mon Sep 17 00:00:00 2001 From: daaawx Date: Sun, 13 Sep 2020 01:18:31 +0200 Subject: [PATCH 1/3] Fix typos in chapter 1 --- docs/query.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/query.rst b/docs/query.rst index 7a2e3f9..e5bf0fb 100644 --- a/docs/query.rst +++ b/docs/query.rst @@ -1,7 +1,7 @@ How to find the query associated with a queryset? ++++++++++++++++++++++++++++++++++++++++++++++++++ -Sometime you want to know how a Django ORM makes our queries execute or what is the corresponding SQL of the code you are writing. This is very strightforward. Youn can get :code:`str` of any :code:`queryset.query` to get the sql. +Sometimes, you want to know how a Django ORM makes our queries execute or what is the corresponding SQL of the code you are writing. This is very straightforward. You can get :code:`str` of any :code:`queryset.query` to get the SQL. You have a model called :code:`Event`. For getting all records, you will write something like :code:`Event.objects.all()`, then do :code:`str(queryset.query)` From 9a9f84e851f77ad6fff430584646cfa45e1681ad Mon Sep 17 00:00:00 2001 From: daaawx Date: Sun, 13 Sep 2020 01:25:08 +0200 Subject: [PATCH 2/3] Fix typos in chapter 2 --- docs/or_query.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/or_query.rst b/docs/or_query.rst index fb6f47e..40747c2 100644 --- a/docs/or_query.rst +++ b/docs/or_query.rst @@ -5,9 +5,9 @@ How to do OR queries in Django ORM? If you are using :code:`django.contrib.auth`, you will have a table called :code:`auth_user`. It will have fields as :code:`username`, :code:`first_name`, :code:`last_name` and more. -A common requirement is performing :code:`OR` filtering with two ore more conditions. Say you want find all users with firstname starting with 'R' and last_name starting with 'D'. +A common requirement is performing :code:`OR` filtering with two or more conditions. Say you want to find all users with firstname starting with 'R' and last_name starting with 'D'. -Django provides two options. +Django provides two options: - :code:`queryset_1 | queryset_2` - :code:`filter(Q()|Q()` From 7a6e1ac268807a83284656933e2fb5d0ee6cb39e Mon Sep 17 00:00:00 2001 From: daaawx Date: Sun, 13 Sep 2020 01:30:47 +0200 Subject: [PATCH 3/3] Fix code example in chapter 4 --- docs/notequal_query.rst | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/docs/notequal_query.rst b/docs/notequal_query.rst index 444d8ba..429b34c 100644 --- a/docs/notequal_query.rst +++ b/docs/notequal_query.rst @@ -22,11 +22,7 @@ Our SQL query for the above condition will look something like :: .. image:: sqluser_notquery.png -Method 1 using exclude - -.. code-block - - +Method 1 using exclude :: >>> queryset = User.objects.exclude(id__lt=5) >>> queryset