diff options
| author | Tom Carrick <tom@carrick.eu> | 2020-07-18 13:17:39 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-09-21 18:24:56 +0200 |
| commit | e387f191f76777015b6ea687ce83cdb05ee47cee (patch) | |
| tree | 003d83b5efda40fbfcdc1aa9302faca9578b1e30 /docs/ref | |
| parent | ba6b32e5efc4c813ba4432777b3b1743d4205d14 (diff) | |
Fixed #31777 -- Added support for database collations to Char/TextFields.
Thanks Simon Charette and Mariusz Felisiak for reviews.
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/checks.txt | 2 | ||||
| -rw-r--r-- | docs/ref/models/fields.txt | 47 |
2 files changed, 41 insertions, 8 deletions
diff --git a/docs/ref/checks.txt b/docs/ref/checks.txt index 0e1ee50b46..ffb629f96c 100644 --- a/docs/ref/checks.txt +++ b/docs/ref/checks.txt @@ -196,6 +196,8 @@ Model fields * **fields.E170**: ``BinaryField``’s ``default`` cannot be a string. Use bytes content instead. * **fields.E180**: ``<database>`` does not support ``JSONField``\s. +* **fields.E190**: ``<database>`` does not support a database collation on + ``<field_type>``\s. * **fields.E900**: ``IPAddressField`` has been removed except for support in historical migrations. * **fields.W900**: ``IPAddressField`` has been deprecated. Support for it diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt index fd7e88d168..93c011fe2c 100644 --- a/docs/ref/models/fields.txt +++ b/docs/ref/models/fields.txt @@ -593,20 +593,36 @@ For large amounts of text, use :class:`~django.db.models.TextField`. The default form widget for this field is a :class:`~django.forms.TextInput`. -:class:`CharField` has one extra required argument: +:class:`CharField` has two extra arguments: .. attribute:: CharField.max_length - The maximum length (in characters) of the field. The max_length is enforced - at the database level and in Django's validation using + Required. The maximum length (in characters) of the field. The max_length + is enforced at the database level and in Django's validation using :class:`~django.core.validators.MaxLengthValidator`. -.. note:: + .. note:: + + If you are writing an application that must be portable to multiple + database backends, you should be aware that there are restrictions on + ``max_length`` for some backends. Refer to the :doc:`database backend + notes </ref/databases>` for details. + +.. attribute:: CharField.db_collation + + .. versionadded:: 3.2 + + Optional. The database collation name of the field. + + .. note:: + + Collation names are not standardized. As such, this will not be + portable across multiple database backends. - If you are writing an application that must be portable to multiple - database backends, you should be aware that there are restrictions on - ``max_length`` for some backends. Refer to the :doc:`database backend - notes </ref/databases>` for details. + .. admonition:: Oracle + + Oracle supports collations only when the ``MAX_STRING_SIZE`` database + initialization parameter is set to ``EXTENDED``. ``DateField`` ------------- @@ -1329,6 +1345,21 @@ If you specify a ``max_length`` attribute, it will be reflected in the However it is not enforced at the model or database level. Use a :class:`CharField` for that. +.. attribute:: TextField.db_collation + + .. versionadded:: 3.2 + + The database collation name of the field. + + .. note:: + + Collation names are not standardized. As such, this will not be + portable across multiple database backends. + + .. admonition:: Oracle + + Oracle does not support collations for a ``TextField``. + ``TimeField`` ------------- |
