Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typos and grammar, add code examples #55

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions docs/notequal_query.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs/or_query.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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(<condition_1>)|Q(<condition_2>)`
Expand Down
2 changes: 1 addition & 1 deletion docs/query.rst
Original file line number Diff line number Diff line change
@@ -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)`
Expand Down