summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMads Jensen <mje@inducks.org>2017-02-11 13:16:35 +0100
committerTim Graham <timograham@gmail.com>2017-02-11 07:16:35 -0500
commitfb5bd38e3b83c7f0d1011de80f922fc34faf740b (patch)
tree645820c1fc79fdb9e78a40060c5df632706cf247 /docs
parentfe2d2884345e1e6a1daadd76e9404c62791ab589 (diff)
Refs #26610 -- Added CIText mixin and CIChar/Email/TextField.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/contrib/postgres/fields.txt32
-rw-r--r--docs/releases/1.11.txt5
2 files changed, 24 insertions, 13 deletions
diff --git a/docs/ref/contrib/postgres/fields.txt b/docs/ref/contrib/postgres/fields.txt
index f0f320b725..513474a103 100644
--- a/docs/ref/contrib/postgres/fields.txt
+++ b/docs/ref/contrib/postgres/fields.txt
@@ -250,22 +250,32 @@ At present using :attr:`~django.db.models.Field.db_index` will create a
A more useful index is a ``GIN`` index, which you should create using a
:class:`~django.db.migrations.operations.RunSQL` operation.
-``CITextField``
-===============
+``CIText`` fields
+=================
-.. class:: CITextField(**options)
+.. class:: CIText(**options)
.. versionadded:: 1.11
- This field is a subclass of :class:`~django.db.models.CharField` backed by
- the citext_ type, a case-insensitive character string type. Read about `the
- performance considerations`_ prior to using this field.
+ A mixin to create case-insensitive text fields backed by the citext_ type.
+ Read about `the performance considerations`_ prior to using it.
+
+ To use ``citext``, use the :class:`.CITextExtension` operation to
+ :ref:`setup the citext extension <create-postgresql-extensions>` in
+ PostgreSQL before the first ``CreateModel`` migration operation.
+
+ Several fields that use the mixin are provided:
+
+.. class:: CICharField(**options)
+.. class:: CIEmailField(**options)
+.. class:: CITextField(**options)
+
+ These fields subclass :class:`~django.db.models.CharField`,
+ :class:`~django.db.models.EmailField`, and
+ :class:`~django.db.models.TextField`, respectively.
- To use this field, setup the ``citext`` extension in PostgreSQL before the
- first ``CreateModel`` migration operation using the
- :class:`~django.contrib.postgres.operations.CITextExtension` operation. The
- code to setup the extension is similar to the example for
- :class:`~django.contrib.postgres.fields.HStoreField`.
+ ``max_length`` won't be enforced in the database since ``citext`` behaves
+ similar to PostgreSQL's ``text`` type.
.. _citext: https://www.postgresql.org/docs/current/static/citext.html
.. _the performance considerations: https://www.postgresql.org/docs/current/static/citext.html#AEN169274
diff --git a/docs/releases/1.11.txt b/docs/releases/1.11.txt
index 02f341a3e5..3fb4968e23 100644
--- a/docs/releases/1.11.txt
+++ b/docs/releases/1.11.txt
@@ -210,10 +210,11 @@ Minor features
parameter to specify a custom class to encode data types not supported by the
standard encoder.
-* The new :class:`~django.contrib.postgres.fields.CITextField` and
+* The new :class:`~django.contrib.postgres.fields.CIText` mixin and
:class:`~django.contrib.postgres.operations.CITextExtension` migration
operation allow using PostgreSQL's ``citext`` extension for case-insensitive
- lookups.
+ lookups. Three fields are provided: :class:`.CICharField`,
+ :class:`.CIEmailField`, and :class:`.CITextField`.
* The new :class:`~django.contrib.postgres.aggregates.JSONBAgg` allows
aggregating values as a JSON array.