diff options
| author | Mridul Dhall <mriduldhall@Mriduls-MacBook-Pro.local> | 2025-09-16 21:50:06 +0100 |
|---|---|---|
| committer | Jacob Walls <jacobtylerwalls@gmail.com> | 2025-12-16 15:06:10 -0500 |
| commit | d1a4979fa55071581411b7d62eb1ee20f2380ae3 (patch) | |
| tree | ba98fe98d6f0d32183464c1a5bba3846a4d687b3 | |
| parent | 922c4cf972e04b1ce7ecee592231106724dcfd09 (diff) | |
Fixed #36594 -- Improved UniqueConstraint's nulls_distinct system check message.
Clarified that the nulls_distinct argument is not supported, as opposed
to certain values for the argument.
Thanks Russell Owen for the report.
| -rw-r--r-- | django/db/models/constraints.py | 4 | ||||
| -rw-r--r-- | docs/ref/checks.txt | 4 | ||||
| -rw-r--r-- | tests/invalid_models_tests/test_models.py | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/django/db/models/constraints.py b/django/db/models/constraints.py index 93251ff322..4286319978 100644 --- a/django/db/models/constraints.py +++ b/django/db/models/constraints.py @@ -408,8 +408,8 @@ class UniqueConstraint(BaseConstraint): ): errors.append( checks.Warning( - f"{connection.display_name} does not support unique constraints " - "with nulls distinct.", + f"{connection.display_name} does not support " + "UniqueConstraint.nulls_distinct.", hint=( "A constraint won't be created. Silence this warning if you " "don't care about it." diff --git a/docs/ref/checks.txt b/docs/ref/checks.txt index 7dfa7c61d2..1e56464a6f 100644 --- a/docs/ref/checks.txt +++ b/docs/ref/checks.txt @@ -447,8 +447,8 @@ Models expression and won't be validated during the model ``full_clean()``. * **models.W046**: ``<database>`` does not support comments on tables (``db_table_comment``). -* **models.W047**: ``<database>`` does not support unique constraints with - nulls distinct. +* **models.W047**: ``<database>`` does not support + ``UniqueConstraint.nulls_distinct``. * **models.E048**: ``constraints/indexes/unique_together`` refers to a ``CompositePrimaryKey`` ``<field name>``, but ``CompositePrimaryKey``\s are not supported for that option. diff --git a/tests/invalid_models_tests/test_models.py b/tests/invalid_models_tests/test_models.py index fe3c812615..679afa3dc6 100644 --- a/tests/invalid_models_tests/test_models.py +++ b/tests/invalid_models_tests/test_models.py @@ -2891,8 +2891,8 @@ class ConstraintsTests(TestCase): ] warn = Warning( - f"{connection.display_name} does not support unique constraints with nulls " - "distinct.", + f"{connection.display_name} does not support " + "UniqueConstraint.nulls_distinct.", hint=( "A constraint won't be created. Silence this warning if you don't care " "about it." |
