mirror of
https://github.com/django/django.git
synced 2025-07-04 17:59:13 +00:00
[1.1.X] Fixed fieldlookup
docs cross-reference directive, and added it to the queryset reference. Refs #12930.
Backport of r12808 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12809 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
9d5fb83b09
commit
6943950dfd
@ -38,7 +38,7 @@ def setup(app):
|
|||||||
app.add_crossref_type(
|
app.add_crossref_type(
|
||||||
directivename = "fieldlookup",
|
directivename = "fieldlookup",
|
||||||
rolename = "lookup",
|
rolename = "lookup",
|
||||||
indextemplate = "pair: %s, field lookup type",
|
indextemplate = "pair: %s; field lookup type",
|
||||||
)
|
)
|
||||||
app.add_description_unit(
|
app.add_description_unit(
|
||||||
directivename = "django-admin",
|
directivename = "django-admin",
|
||||||
|
@ -1142,6 +1142,8 @@ specified as keyword arguments to the ``QuerySet`` methods ``filter()``,
|
|||||||
|
|
||||||
For an introduction, see :ref:`field-lookups-intro`.
|
For an introduction, see :ref:`field-lookups-intro`.
|
||||||
|
|
||||||
|
.. fieldlookup:: exact
|
||||||
|
|
||||||
exact
|
exact
|
||||||
~~~~~
|
~~~~~
|
||||||
|
|
||||||
@ -1173,6 +1175,8 @@ SQL equivalents::
|
|||||||
information about this, see the :ref:`collation section <mysql-collation>`
|
information about this, see the :ref:`collation section <mysql-collation>`
|
||||||
in the :ref:`databases <ref-databases>` documentation.
|
in the :ref:`databases <ref-databases>` documentation.
|
||||||
|
|
||||||
|
.. fieldlookup:: iexact
|
||||||
|
|
||||||
iexact
|
iexact
|
||||||
~~~~~~
|
~~~~~~
|
||||||
|
|
||||||
@ -1196,6 +1200,8 @@ BLoG'``, etc.
|
|||||||
comparisons. SQLite does not do case-insensitive matching for Unicode
|
comparisons. SQLite does not do case-insensitive matching for Unicode
|
||||||
strings.
|
strings.
|
||||||
|
|
||||||
|
.. fieldlookup:: contains
|
||||||
|
|
||||||
contains
|
contains
|
||||||
~~~~~~~~
|
~~~~~~~~
|
||||||
|
|
||||||
@ -1215,6 +1221,8 @@ Note this will match the headline ``'Today Lennon honored'`` but not
|
|||||||
SQLite doesn't support case-sensitive ``LIKE`` statements; ``contains`` acts
|
SQLite doesn't support case-sensitive ``LIKE`` statements; ``contains`` acts
|
||||||
like ``icontains`` for SQLite.
|
like ``icontains`` for SQLite.
|
||||||
|
|
||||||
|
.. fieldlookup:: icontains
|
||||||
|
|
||||||
icontains
|
icontains
|
||||||
~~~~~~~~~
|
~~~~~~~~~
|
||||||
|
|
||||||
@ -1234,6 +1242,8 @@ SQL equivalent::
|
|||||||
mind the :ref:`database note <sqlite-string-matching>` about string
|
mind the :ref:`database note <sqlite-string-matching>` about string
|
||||||
comparisons.
|
comparisons.
|
||||||
|
|
||||||
|
.. fieldlookup:: in
|
||||||
|
|
||||||
in
|
in
|
||||||
~~
|
~~
|
||||||
|
|
||||||
@ -1305,6 +1315,8 @@ extract two field values, where only one is expected::
|
|||||||
name__contains='Cheddar').values_list('pk', flat=True)
|
name__contains='Cheddar').values_list('pk', flat=True)
|
||||||
entries = Entry.objects.filter(blog__in=values)
|
entries = Entry.objects.filter(blog__in=values)
|
||||||
|
|
||||||
|
.. fieldlookup:: gt
|
||||||
|
|
||||||
gt
|
gt
|
||||||
~~
|
~~
|
||||||
|
|
||||||
@ -1318,21 +1330,29 @@ SQL equivalent::
|
|||||||
|
|
||||||
SELECT ... WHERE id > 4;
|
SELECT ... WHERE id > 4;
|
||||||
|
|
||||||
|
.. fieldlookup:: gte
|
||||||
|
|
||||||
gte
|
gte
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
Greater than or equal to.
|
Greater than or equal to.
|
||||||
|
|
||||||
|
.. fieldlookup:: lt
|
||||||
|
|
||||||
lt
|
lt
|
||||||
~~
|
~~
|
||||||
|
|
||||||
Less than.
|
Less than.
|
||||||
|
|
||||||
|
.. fieldlookup:: lte
|
||||||
|
|
||||||
lte
|
lte
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
Less than or equal to.
|
Less than or equal to.
|
||||||
|
|
||||||
|
.. fieldlookup:: startswith
|
||||||
|
|
||||||
startswith
|
startswith
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
|
|
||||||
@ -1349,6 +1369,8 @@ SQL equivalent::
|
|||||||
SQLite doesn't support case-sensitive ``LIKE`` statements; ``startswith`` acts
|
SQLite doesn't support case-sensitive ``LIKE`` statements; ``startswith`` acts
|
||||||
like ``istartswith`` for SQLite.
|
like ``istartswith`` for SQLite.
|
||||||
|
|
||||||
|
.. fieldlookup:: istartswith
|
||||||
|
|
||||||
istartswith
|
istartswith
|
||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
|
|
||||||
@ -1368,6 +1390,8 @@ SQL equivalent::
|
|||||||
mind the :ref:`database note <sqlite-string-matching>` about string
|
mind the :ref:`database note <sqlite-string-matching>` about string
|
||||||
comparisons.
|
comparisons.
|
||||||
|
|
||||||
|
.. fieldlookup:: endswith
|
||||||
|
|
||||||
endswith
|
endswith
|
||||||
~~~~~~~~
|
~~~~~~~~
|
||||||
|
|
||||||
@ -1384,6 +1408,8 @@ SQL equivalent::
|
|||||||
SQLite doesn't support case-sensitive ``LIKE`` statements; ``endswith`` acts
|
SQLite doesn't support case-sensitive ``LIKE`` statements; ``endswith`` acts
|
||||||
like ``iendswith`` for SQLite.
|
like ``iendswith`` for SQLite.
|
||||||
|
|
||||||
|
.. fieldlookup:: iendswith
|
||||||
|
|
||||||
iendswith
|
iendswith
|
||||||
~~~~~~~~~
|
~~~~~~~~~
|
||||||
|
|
||||||
@ -1403,6 +1429,8 @@ SQL equivalent::
|
|||||||
mind the :ref:`database note <sqlite-string-matching>` about string
|
mind the :ref:`database note <sqlite-string-matching>` about string
|
||||||
comparisons.
|
comparisons.
|
||||||
|
|
||||||
|
.. fieldlookup:: range
|
||||||
|
|
||||||
range
|
range
|
||||||
~~~~~
|
~~~~~
|
||||||
|
|
||||||
@ -1421,6 +1449,8 @@ SQL equivalent::
|
|||||||
You can use ``range`` anywhere you can use ``BETWEEN`` in SQL -- for dates,
|
You can use ``range`` anywhere you can use ``BETWEEN`` in SQL -- for dates,
|
||||||
numbers and even characters.
|
numbers and even characters.
|
||||||
|
|
||||||
|
.. fieldlookup:: year
|
||||||
|
|
||||||
year
|
year
|
||||||
~~~~
|
~~~~
|
||||||
|
|
||||||
@ -1436,6 +1466,8 @@ SQL equivalent::
|
|||||||
|
|
||||||
(The exact SQL syntax varies for each database engine.)
|
(The exact SQL syntax varies for each database engine.)
|
||||||
|
|
||||||
|
.. fieldlookup:: month
|
||||||
|
|
||||||
month
|
month
|
||||||
~~~~~
|
~~~~~
|
||||||
|
|
||||||
@ -1452,6 +1484,8 @@ SQL equivalent::
|
|||||||
|
|
||||||
(The exact SQL syntax varies for each database engine.)
|
(The exact SQL syntax varies for each database engine.)
|
||||||
|
|
||||||
|
.. fieldlookup:: day
|
||||||
|
|
||||||
day
|
day
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
@ -1470,6 +1504,8 @@ SQL equivalent::
|
|||||||
Note this will match any record with a pub_date on the third day of the month,
|
Note this will match any record with a pub_date on the third day of the month,
|
||||||
such as January 3, July 3, etc.
|
such as January 3, July 3, etc.
|
||||||
|
|
||||||
|
.. fieldlookup:: week_day
|
||||||
|
|
||||||
week_day
|
week_day
|
||||||
~~~~~~~~
|
~~~~~~~~
|
||||||
|
|
||||||
@ -1491,6 +1527,8 @@ Note this will match any record with a pub_date that falls on a Monday (day 2
|
|||||||
of the week), regardless of the month or year in which it occurs. Week days
|
of the week), regardless of the month or year in which it occurs. Week days
|
||||||
are indexed with day 1 being Sunday and day 7 being Saturday.
|
are indexed with day 1 being Sunday and day 7 being Saturday.
|
||||||
|
|
||||||
|
.. fieldlookup:: isnull
|
||||||
|
|
||||||
isnull
|
isnull
|
||||||
~~~~~~
|
~~~~~~
|
||||||
|
|
||||||
@ -1505,6 +1543,8 @@ SQL equivalent::
|
|||||||
|
|
||||||
SELECT ... WHERE pub_date IS NULL;
|
SELECT ... WHERE pub_date IS NULL;
|
||||||
|
|
||||||
|
.. fieldlookup:: search
|
||||||
|
|
||||||
search
|
search
|
||||||
~~~~~~
|
~~~~~~
|
||||||
|
|
||||||
@ -1524,6 +1564,8 @@ database to add the full-text index. By default Django uses BOOLEAN MODE for
|
|||||||
full text searches. `Please check MySQL documentation for additional details. <http://dev.mysql.com/doc/refman/5.1/en/fulltext-boolean.html>`_
|
full text searches. `Please check MySQL documentation for additional details. <http://dev.mysql.com/doc/refman/5.1/en/fulltext-boolean.html>`_
|
||||||
|
|
||||||
|
|
||||||
|
.. fieldlookup:: regex
|
||||||
|
|
||||||
regex
|
regex
|
||||||
~~~~~
|
~~~~~
|
||||||
|
|
||||||
@ -1553,6 +1595,8 @@ SQL equivalents::
|
|||||||
Using raw strings (e.g., ``r'foo'`` instead of ``'foo'``) for passing in the
|
Using raw strings (e.g., ``r'foo'`` instead of ``'foo'``) for passing in the
|
||||||
regular expression syntax is recommended.
|
regular expression syntax is recommended.
|
||||||
|
|
||||||
|
.. fieldlookup:: iregex
|
||||||
|
|
||||||
iregex
|
iregex
|
||||||
~~~~~~
|
~~~~~~
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user