mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #26124 -- Added missing code formatting to docs headers.
This commit is contained in:
@@ -7,8 +7,8 @@ module.
|
||||
|
||||
.. currentmodule:: django.contrib.postgres.fields
|
||||
|
||||
ArrayField
|
||||
==========
|
||||
``ArrayField``
|
||||
==============
|
||||
|
||||
.. class:: ArrayField(base_field, size=None, **options)
|
||||
|
||||
@@ -91,8 +91,8 @@ ArrayField
|
||||
If irregular shapes are required, then the underlying field should be made
|
||||
nullable and the values padded with ``None``.
|
||||
|
||||
Querying ArrayField
|
||||
-------------------
|
||||
Querying ``ArrayField``
|
||||
-----------------------
|
||||
|
||||
There are a number of custom lookups and transforms for :class:`ArrayField`.
|
||||
We will use the following example model::
|
||||
@@ -109,8 +109,8 @@ We will use the following example model::
|
||||
|
||||
.. fieldlookup:: arrayfield.contains
|
||||
|
||||
contains
|
||||
~~~~~~~~
|
||||
``contains``
|
||||
~~~~~~~~~~~~
|
||||
|
||||
The :lookup:`contains` lookup is overridden on :class:`ArrayField`. The
|
||||
returned objects will be those where the values passed are a subset of the
|
||||
@@ -131,8 +131,8 @@ data. It uses the SQL operator ``@>``. For example::
|
||||
|
||||
.. fieldlookup:: arrayfield.contained_by
|
||||
|
||||
contained_by
|
||||
~~~~~~~~~~~~
|
||||
``contained_by``
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
This is the inverse of the :lookup:`contains <arrayfield.contains>` lookup -
|
||||
the objects returned will be those where the data is a subset of the values
|
||||
@@ -150,8 +150,8 @@ passed. It uses the SQL operator ``<@``. For example::
|
||||
|
||||
.. fieldlookup:: arrayfield.overlap
|
||||
|
||||
overlap
|
||||
~~~~~~~
|
||||
``overlap``
|
||||
~~~~~~~~~~~
|
||||
|
||||
Returns objects where the data shares any results with the values passed. Uses
|
||||
the SQL operator ``&&``. For example::
|
||||
@@ -168,8 +168,8 @@ the SQL operator ``&&``. For example::
|
||||
|
||||
.. fieldlookup:: arrayfield.len
|
||||
|
||||
len
|
||||
~~~
|
||||
``len``
|
||||
~~~~~~~
|
||||
|
||||
Returns the length of the array. The lookups available afterwards are those
|
||||
available for :class:`~django.db.models.IntegerField`. For example::
|
||||
@@ -242,16 +242,16 @@ lookups available after the transform do not change. For example::
|
||||
at the database level and cannot be supported in a logical, consistent
|
||||
fashion by Django.
|
||||
|
||||
Indexing ArrayField
|
||||
-------------------
|
||||
Indexing ``ArrayField``
|
||||
-----------------------
|
||||
|
||||
At present using :attr:`~django.db.models.Field.db_index` will create a
|
||||
``btree`` index. This does not offer particularly significant help to querying.
|
||||
A more useful index is a ``GIN`` index, which you should create using a
|
||||
:class:`~django.db.migrations.operations.RunSQL` operation.
|
||||
|
||||
HStoreField
|
||||
===========
|
||||
``HStoreField``
|
||||
===============
|
||||
|
||||
.. class:: HStoreField(**options)
|
||||
|
||||
@@ -292,8 +292,8 @@ HStoreField
|
||||
valid for a given field. This can be done using the
|
||||
:class:`~django.contrib.postgres.validators.KeysValidator`.
|
||||
|
||||
Querying HStoreField
|
||||
--------------------
|
||||
Querying ``HStoreField``
|
||||
------------------------
|
||||
|
||||
In addition to the ability to query by key, there are a number of custom
|
||||
lookups available for ``HStoreField``.
|
||||
@@ -340,8 +340,8 @@ need to use the :lookup:`hstorefield.contains` lookup instead.
|
||||
|
||||
.. fieldlookup:: hstorefield.contains
|
||||
|
||||
contains
|
||||
~~~~~~~~
|
||||
``contains``
|
||||
~~~~~~~~~~~~
|
||||
|
||||
The :lookup:`contains` lookup is overridden on
|
||||
:class:`~django.contrib.postgres.fields.HStoreField`. The returned objects are
|
||||
@@ -360,8 +360,8 @@ field. It uses the SQL operator ``@>``. For example::
|
||||
|
||||
.. fieldlookup:: hstorefield.contained_by
|
||||
|
||||
contained_by
|
||||
~~~~~~~~~~~~
|
||||
``contained_by``
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
This is the inverse of the :lookup:`contains <hstorefield.contains>` lookup -
|
||||
the objects returned will be those where the key-value pairs on the object are
|
||||
@@ -380,8 +380,8 @@ example::
|
||||
|
||||
.. fieldlookup:: hstorefield.has_key
|
||||
|
||||
has_key
|
||||
~~~~~~~
|
||||
``has_key``
|
||||
~~~~~~~~~~~
|
||||
|
||||
Returns objects where the given key is in the data. Uses the SQL operator
|
||||
``?``. For example::
|
||||
@@ -394,8 +394,8 @@ Returns objects where the given key is in the data. Uses the SQL operator
|
||||
|
||||
.. fieldlookup:: hstorefield.has_any_keys
|
||||
|
||||
has_any_keys
|
||||
~~~~~~~~~~~~
|
||||
``has_any_keys``
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
.. versionadded:: 1.9
|
||||
|
||||
@@ -411,8 +411,8 @@ operator ``?|``. For example::
|
||||
|
||||
.. fieldlookup:: hstorefield.has_keys
|
||||
|
||||
has_keys
|
||||
~~~~~~~~
|
||||
``has_keys``
|
||||
~~~~~~~~~~~~
|
||||
|
||||
Returns objects where all of the given keys are in the data. Uses the SQL operator
|
||||
``?&``. For example::
|
||||
@@ -425,8 +425,8 @@ Returns objects where all of the given keys are in the data. Uses the SQL operat
|
||||
|
||||
.. fieldlookup:: hstorefield.keys
|
||||
|
||||
keys
|
||||
~~~~
|
||||
``keys``
|
||||
~~~~~~~~
|
||||
|
||||
Returns objects where the array of keys is the given value. Note that the order
|
||||
is not guaranteed to be reliable, so this transform is mainly useful for using
|
||||
@@ -442,8 +442,8 @@ in conjunction with lookups on
|
||||
|
||||
.. fieldlookup:: hstorefield.values
|
||||
|
||||
values
|
||||
~~~~~~
|
||||
``values``
|
||||
~~~~~~~~~~
|
||||
|
||||
Returns objects where the array of values is the given value. Note that the
|
||||
order is not guaranteed to be reliable, so this transform is mainly useful for
|
||||
@@ -457,8 +457,8 @@ using in conjunction with lookups on
|
||||
>>> Dog.objects.filter(data__values__contains=['collie'])
|
||||
<QuerySet [<Dog: Meg>]>
|
||||
|
||||
JSONField
|
||||
=========
|
||||
``JSONField``
|
||||
=============
|
||||
|
||||
.. versionadded:: 1.9
|
||||
|
||||
@@ -492,8 +492,8 @@ JSONField
|
||||
|
||||
**As a result, this field requires PostgreSQL ≥ 9.4 and Psycopg2 ≥ 2.5.4**.
|
||||
|
||||
Querying JSONField
|
||||
------------------
|
||||
Querying ``JSONField``
|
||||
----------------------
|
||||
|
||||
We will use the following example model::
|
||||
|
||||
@@ -588,8 +588,8 @@ All of the range fields translate to :ref:`psycopg2 Range objects
|
||||
information is necessary. The default is lower bound included, upper bound
|
||||
excluded.
|
||||
|
||||
IntegerRangeField
|
||||
-----------------
|
||||
``IntegerRangeField``
|
||||
---------------------
|
||||
|
||||
.. class:: IntegerRangeField(**options)
|
||||
|
||||
@@ -598,8 +598,8 @@ IntegerRangeField
|
||||
the database and a :class:`~psycopg2:psycopg2.extras.NumericRange` in
|
||||
Python.
|
||||
|
||||
BigIntegerRangeField
|
||||
--------------------
|
||||
``BigIntegerRangeField``
|
||||
------------------------
|
||||
|
||||
.. class:: BigIntegerRangeField(**options)
|
||||
|
||||
@@ -608,8 +608,8 @@ BigIntegerRangeField
|
||||
in the database and a :class:`~psycopg2:psycopg2.extras.NumericRange` in
|
||||
Python.
|
||||
|
||||
FloatRangeField
|
||||
---------------
|
||||
``FloatRangeField``
|
||||
-------------------
|
||||
|
||||
.. class:: FloatRangeField(**options)
|
||||
|
||||
@@ -617,8 +617,8 @@ FloatRangeField
|
||||
:class:`~django.db.models.FloatField`. Represented by a ``numrange`` in the
|
||||
database and a :class:`~psycopg2:psycopg2.extras.NumericRange` in Python.
|
||||
|
||||
DateTimeRangeField
|
||||
------------------
|
||||
``DateTimeRangeField``
|
||||
----------------------
|
||||
|
||||
.. class:: DateTimeRangeField(**options)
|
||||
|
||||
@@ -627,8 +627,8 @@ DateTimeRangeField
|
||||
the database and a :class:`~psycopg2:psycopg2.extras.DateTimeTZRange` in
|
||||
Python.
|
||||
|
||||
DateRangeField
|
||||
--------------
|
||||
``DateRangeField``
|
||||
------------------
|
||||
|
||||
.. class:: DateRangeField(**options)
|
||||
|
||||
@@ -675,16 +675,16 @@ operators ``@>``, ``<@``, and ``&&`` respectively.
|
||||
|
||||
.. fieldlookup:: rangefield.contains
|
||||
|
||||
contains
|
||||
^^^^^^^^
|
||||
``contains``
|
||||
^^^^^^^^^^^^
|
||||
|
||||
>>> Event.objects.filter(ages__contains=NumericRange(4, 5))
|
||||
<QuerySet [<Event: Soft play>]>
|
||||
|
||||
.. fieldlookup:: rangefield.contained_by
|
||||
|
||||
contained_by
|
||||
^^^^^^^^^^^^
|
||||
``contained_by``
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
>>> Event.objects.filter(ages__contained_by=NumericRange(0, 15))
|
||||
<QuerySet [<Event: Soft play>]>
|
||||
@@ -707,8 +707,8 @@ contained_by
|
||||
|
||||
.. fieldlookup:: rangefield.overlap
|
||||
|
||||
overlap
|
||||
^^^^^^^
|
||||
``overlap``
|
||||
^^^^^^^^^^^
|
||||
|
||||
>>> Event.objects.filter(ages__overlap=NumericRange(8, 12))
|
||||
<QuerySet [<Event: Soft play>]>
|
||||
@@ -724,8 +724,8 @@ the specific range comparison operators.
|
||||
|
||||
.. fieldlookup:: rangefield.fully_lt
|
||||
|
||||
fully_lt
|
||||
^^^^^^^^
|
||||
``fully_lt``
|
||||
^^^^^^^^^^^^
|
||||
|
||||
The returned ranges are strictly less than the passed range. In other words,
|
||||
all the points in the returned range are less than all those in the passed
|
||||
@@ -736,8 +736,8 @@ range.
|
||||
|
||||
.. fieldlookup:: rangefield.fully_gt
|
||||
|
||||
fully_gt
|
||||
^^^^^^^^
|
||||
``fully_gt``
|
||||
^^^^^^^^^^^^
|
||||
|
||||
The returned ranges are strictly greater than the passed range. In other words,
|
||||
the all the points in the returned range are greater than all those in the
|
||||
@@ -748,8 +748,8 @@ passed range.
|
||||
|
||||
.. fieldlookup:: rangefield.not_lt
|
||||
|
||||
not_lt
|
||||
^^^^^^
|
||||
``not_lt``
|
||||
^^^^^^^^^^
|
||||
|
||||
The returned ranges do not contain any points less than the passed range, that
|
||||
is the lower bound of the returned range is at least the lower bound of the
|
||||
@@ -760,8 +760,8 @@ passed range.
|
||||
|
||||
.. fieldlookup:: rangefield.not_gt
|
||||
|
||||
not_gt
|
||||
^^^^^^
|
||||
``not_gt``
|
||||
^^^^^^^^^^
|
||||
|
||||
The returned ranges do not contain any points greater than the passed range, that
|
||||
is the upper bound of the returned range is at most the upper bound of the
|
||||
@@ -772,8 +772,8 @@ passed range.
|
||||
|
||||
.. fieldlookup:: rangefield.adjacent_to
|
||||
|
||||
adjacent_to
|
||||
^^^^^^^^^^^
|
||||
``adjacent_to``
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
The returned ranges share a bound with the passed range.
|
||||
|
||||
@@ -788,8 +788,8 @@ lower or upper bound, or query based on emptiness.
|
||||
|
||||
.. fieldlookup:: rangefield.startswith
|
||||
|
||||
startswith
|
||||
^^^^^^^^^^
|
||||
``startswith``
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
Returned objects have the given lower bound. Can be chained to valid lookups
|
||||
for the base field.
|
||||
@@ -799,8 +799,8 @@ for the base field.
|
||||
|
||||
.. fieldlookup:: rangefield.endswith
|
||||
|
||||
endswith
|
||||
^^^^^^^^
|
||||
``endswith``
|
||||
^^^^^^^^^^^^
|
||||
|
||||
Returned objects have the given upper bound. Can be chained to valid lookups
|
||||
for the base field.
|
||||
@@ -810,8 +810,8 @@ for the base field.
|
||||
|
||||
.. fieldlookup:: rangefield.isempty
|
||||
|
||||
isempty
|
||||
^^^^^^^
|
||||
``isempty``
|
||||
^^^^^^^^^^^
|
||||
|
||||
Returned objects are empty ranges. Can be chained to valid lookups for a
|
||||
:class:`~django.db.models.BooleanField`.
|
||||
|
||||
Reference in New Issue
Block a user