From 292b3be698ef58aff9c215d62a444f66ead578c3 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Fri, 2 Oct 2020 13:29:50 +0200 Subject: [PATCH] Refs #31777 -- Doc'd Char/TextField.db_collation parameter in MySQL notes. --- docs/ref/databases.txt | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt index 8c87eb6818..809ee68db6 100644 --- a/docs/ref/databases.txt +++ b/docs/ref/databases.txt @@ -398,11 +398,15 @@ Collation settings ~~~~~~~~~~~~~~~~~~ The collation setting for a column controls the order in which data is sorted -as well as what strings compare as equal. It can be set on a database-wide -level and also per-table and per-column. This is `documented thoroughly`_ in -the MySQL documentation. In all cases, you set the collation by directly -manipulating the database tables; Django doesn't provide a way to set this on -the model definition. +as well as what strings compare as equal. You can specify the ``db_collation`` +parameter to set the collation name of the column for +:attr:`CharField ` and +:attr:`TextField `. + +The collation can also be set on a database-wide level and per-table. This is +`documented thoroughly`_ in the MySQL documentation. In such cases, you must +set the collation by directly manipulating the database settings or tables. +Django doesn't provide an API to change them. .. _documented thoroughly: https://dev.mysql.com/doc/refman/en/charset.html @@ -432,6 +436,10 @@ because it is more accurate. differ only by case will pass validation, but upon calling ``save()``, an ``IntegrityError`` will be raised. +.. versionchanged:: 3.2 + + Support for setting a database collation for the field was added. + Connecting to the database --------------------------