[1.9.x] Fixed #26124 -- Added missing code formatting to docs headers.

Backport of a6ef025dfb from master
This commit is contained in:
Tim Graham 2016-02-01 11:54:26 -05:00
parent d7a6086825
commit a9fbf0735a
93 changed files with 1677 additions and 1622 deletions

View file

@ -21,47 +21,47 @@ These functions are described in more detail in the `PostgreSQL docs
General-purpose aggregation functions
=====================================
ArrayAgg
--------
``ArrayAgg``
------------
.. class:: ArrayAgg(expression, **extra)
Returns a list of values, including nulls, concatenated into an array.
BitAnd
------
``BitAnd``
----------
.. class:: BitAnd(expression, **extra)
Returns an ``int`` of the bitwise ``AND`` of all non-null input values, or
``None`` if all values are null.
BitOr
-----
``BitOr``
---------
.. class:: BitOr(expression, **extra)
Returns an ``int`` of the bitwise ``OR`` of all non-null input values, or
``None`` if all values are null.
BoolAnd
-------
``BoolAnd``
-----------
.. class:: BoolAnd(expression, **extra)
Returns ``True``, if all input values are true, ``None`` if all values are
null or if there are no values, otherwise ``False`` .
BoolOr
------
``BoolOr``
----------
.. class:: BoolOr(expression, **extra)
Returns ``True`` if at least one input value is true, ``None`` if all
values are null or if there are no values, otherwise ``False``.
StringAgg
---------
``StringAgg``
-------------
.. class:: StringAgg(expression, delimiter)
@ -81,16 +81,16 @@ Aggregate functions for statistics
The arguments ``y`` and ``x`` for all these functions can be the name of a
field or an expression returning a numeric data. Both are required.
Corr
----
``Corr``
--------
.. class:: Corr(y, x)
Returns the correlation coefficient as a ``float``, or ``None`` if there
aren't any matching rows.
CovarPop
--------
``CovarPop``
------------
.. class:: CovarPop(y, x, sample=False)
@ -105,32 +105,32 @@ CovarPop
However, if ``sample=True``, the return value will be the sample
population covariance.
RegrAvgX
--------
``RegrAvgX``
------------
.. class:: RegrAvgX(y, x)
Returns the average of the independent variable (``sum(x)/N``) as a
``float``, or ``None`` if there aren't any matching rows.
RegrAvgY
--------
``RegrAvgY``
------------
.. class:: RegrAvgY(y, x)
Returns the average of the independent variable (``sum(y)/N``) as a
``float``, or ``None`` if there aren't any matching rows.
RegrCount
---------
``RegrCount``
-------------
.. class:: RegrCount(y, x)
Returns an ``int`` of the number of input rows in which both expressions
are not null.
RegrIntercept
-------------
``RegrIntercept``
-----------------
.. class:: RegrIntercept(y, x)
@ -138,16 +138,16 @@ RegrIntercept
by the ``(x, y)`` pairs as a ``float``, or ``None`` if there aren't any
matching rows.
RegrR2
------
``RegrR2``
----------
.. class:: RegrR2(y, x)
Returns the square of the correlation coefficient as a ``float``, or
``None`` if there aren't any matching rows.
RegrSlope
---------
``RegrSlope``
-------------
.. class:: RegrSlope(y, x)
@ -155,16 +155,16 @@ RegrSlope
by the ``(x, y)`` pairs as a ``float``, or ``None`` if there aren't any
matching rows.
RegrSXX
-------
``RegrSXX``
-----------
.. class:: RegrSXX(y, x)
Returns ``sum(x^2) - sum(x)^2/N`` ("sum of squares" of the independent
variable) as a ``float``, or ``None`` if there aren't any matching rows.
RegrSXY
-------
``RegrSXY``
-----------
.. class:: RegrSXY(y, x)
@ -172,8 +172,8 @@ RegrSXY
times dependent variable) as a ``float``, or ``None`` if there aren't any
matching rows.
RegrSYY
-------
``RegrSYY``
-----------
.. class:: RegrSYY(y, x)

View file

@ -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'])
[<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))
[<Event: Soft play>]
.. fieldlookup:: rangefield.contained_by
contained_by
^^^^^^^^^^^^
``contained_by``
^^^^^^^^^^^^^^^^
>>> Event.objects.filter(ages__contained_by=NumericRange(0, 15))
[<Event: Soft play>]
@ -707,8 +707,8 @@ contained_by
.. fieldlookup:: rangefield.overlap
overlap
^^^^^^^
``overlap``
^^^^^^^^^^^
>>> Event.objects.filter(ages__overlap=NumericRange(8, 12))
[<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`.

View file

@ -10,8 +10,8 @@ All of these fields and widgets are available from the
Fields
======
SimpleArrayField
----------------
``SimpleArrayField``
--------------------
.. class:: SimpleArrayField(base_field, delimiter=',', max_length=None, min_length=None)
@ -82,8 +82,8 @@ SimpleArrayField
however it is a useful way to format data from a client-side widget for
submission to the server.
SplitArrayField
---------------
``SplitArrayField``
-------------------
.. class:: SplitArrayField(base_field, size, remove_trailing_nulls=False)
@ -138,8 +138,8 @@ SplitArrayField
['1', '', '3'] # -> [1, None, 3]
['', '2', ''] # -> [None, 2]
HStoreField
-----------
``HStoreField``
---------------
.. class:: HStoreField
@ -159,8 +159,8 @@ HStoreField
valid for a given field. This can be done using the
:class:`~django.contrib.postgres.validators.KeysValidator`.
JSONField
---------
``JSONField``
-------------
.. class:: JSONField
@ -183,8 +183,8 @@ omitted value as an unbounded range. They also validate that the lower bound is
not greater than the upper bound. All of these fields use
:class:`~django.contrib.postgres.forms.RangeWidget`.
IntegerRangeField
~~~~~~~~~~~~~~~~~
``IntegerRangeField``
~~~~~~~~~~~~~~~~~~~~~
.. class:: IntegerRangeField
@ -193,8 +193,8 @@ IntegerRangeField
:class:`~django.contrib.postgres.fields.IntegerRangeField` and
:class:`~django.contrib.postgres.fields.BigIntegerRangeField`.
FloatRangeField
~~~~~~~~~~~~~~~
``FloatRangeField``
~~~~~~~~~~~~~~~~~~~
.. class:: FloatRangeField
@ -202,8 +202,8 @@ FloatRangeField
:class:`~psycopg2:psycopg2.extras.NumericRange`. Default for
:class:`~django.contrib.postgres.fields.FloatRangeField`.
DateTimeRangeField
~~~~~~~~~~~~~~~~~~
``DateTimeRangeField``
~~~~~~~~~~~~~~~~~~~~~~
.. class:: DateTimeRangeField
@ -211,8 +211,8 @@ DateTimeRangeField
:class:`~psycopg2:psycopg2.extras.DateTimeTZRange`. Default for
:class:`~django.contrib.postgres.fields.DateTimeRangeField`.
DateRangeField
~~~~~~~~~~~~~~
``DateRangeField``
~~~~~~~~~~~~~~~~~~
.. class:: DateRangeField
@ -223,8 +223,8 @@ DateRangeField
Widgets
=======
RangeWidget
-----------
``RangeWidget``
---------------
.. class:: RangeWidget(base_widget, attrs=None)

View file

@ -7,8 +7,8 @@ All of these functions are available from the
.. currentmodule:: django.contrib.postgres.functions
TransactionNow
==============
``TransactionNow``
==================
.. class:: TransactionNow()

View file

@ -2,8 +2,8 @@
PostgreSQL specific lookups
===========================
Unaccent
========
``Unaccent``
============
.. fieldlookup:: unaccent

View file

@ -7,8 +7,8 @@ the ``django.contrib.postgres.operations`` module.
.. currentmodule:: django.contrib.postgres.operations
CreateExtension
===============
``CreateExtension``
===================
.. class:: CreateExtension(name)
@ -18,8 +18,8 @@ CreateExtension
This is a required argument. The name of the extension to be installed.
HStoreExtension
===============
``HStoreExtension``
===================
.. class:: HStoreExtension()
@ -27,8 +27,8 @@ HStoreExtension
which will install the ``hstore`` extension and also immediately set up the
connection to interpret hstore data.
UnaccentExtension
=================
``UnaccentExtension``
=====================
.. class:: UnaccentExtension()

View file

@ -22,11 +22,17 @@ Validators
Range validators
================
``RangeMaxValueValidator``
--------------------------
.. class:: RangeMaxValueValidator(limit_value, message=None)
Validates that the upper bound of the range is not greater than
``limit_value``.
``RangeMinValueValidator``
--------------------------
.. class:: RangeMinValueValidator(limit_value, message=None)
Validates that the lower bound of the range is not less than the