updated docs
This commit is contained in:
@@ -45,6 +45,12 @@ Retrieving objects with filters
|
||||
|
||||
q = Automobile.objects.filter(manufacturer='Tesla')
|
||||
|
||||
You can also use the more convenient syntax:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
q = Automobile.objects(Automobile.manufacturer == 'Tesla')
|
||||
|
||||
We can then further filter our query with another call to **.filter**
|
||||
|
||||
.. code-block:: python
|
||||
@@ -123,6 +129,7 @@ Filtering Operators
|
||||
q = Automobile.objects.filter(manufacturer='Tesla')
|
||||
q = q.filter(year__in=[2011, 2012])
|
||||
|
||||
|
||||
:attr:`> (__gt) <query.QueryOperator.GreaterThanOperator>`
|
||||
|
||||
.. code-block:: python
|
||||
@@ -130,6 +137,10 @@ Filtering Operators
|
||||
q = Automobile.objects.filter(manufacturer='Tesla')
|
||||
q = q.filter(year__gt=2010) # year > 2010
|
||||
|
||||
# or the nicer syntax
|
||||
|
||||
q.filter(Automobile.year > 2010)
|
||||
|
||||
:attr:`>= (__gte) <query.QueryOperator.GreaterThanOrEqualOperator>`
|
||||
|
||||
.. code-block:: python
|
||||
@@ -137,6 +148,10 @@ Filtering Operators
|
||||
q = Automobile.objects.filter(manufacturer='Tesla')
|
||||
q = q.filter(year__gte=2010) # year >= 2010
|
||||
|
||||
# or the nicer syntax
|
||||
|
||||
Automobile.objects.filter(Automobile.manufacturer == 'Tesla')
|
||||
|
||||
:attr:`< (__lt) <query.QueryOperator.LessThanOperator>`
|
||||
|
||||
.. code-block:: python
|
||||
@@ -144,6 +159,10 @@ Filtering Operators
|
||||
q = Automobile.objects.filter(manufacturer='Tesla')
|
||||
q = q.filter(year__lt=2012) # year < 2012
|
||||
|
||||
# or...
|
||||
|
||||
q.filter(Automobile.year < 2012)
|
||||
|
||||
:attr:`<= (__lte) <query.QueryOperator.LessThanOrEqualOperator>`
|
||||
|
||||
.. code-block:: python
|
||||
@@ -151,6 +170,8 @@ Filtering Operators
|
||||
q = Automobile.objects.filter(manufacturer='Tesla')
|
||||
q = q.filter(year__lte=2012) # year <= 2012
|
||||
|
||||
q.filter(Automobile.year <= 2012)
|
||||
|
||||
|
||||
TimeUUID Functions
|
||||
==================
|
||||
|
||||
Reference in New Issue
Block a user