| Age | Commit message (Collapse) | Author | |
|---|---|---|---|
| 2026-04-22 | Fixed #37057 -- Adjusted UniqueConstraint handling of UNKNOWN condition. | Simon Charette | |
| When we adjusted UNKNOWN handling for CheckConstraint in refs #33996 we assumed that all usage of Q.check would benefit from this approach. However while CHECK constraints enforcement do ignore conditions involving NULL that resolve to UNKNOWN it's not the case for other type of constraints such as UNIQUE ones. Given how UNKNOWN should be treated depends on the callers context it appears that a better strategy for COALESCE wrapping is to force them to apply it if necessary. Thanks Drew Shapiro for the report. | |||
| 2025-12-19 | Fixed #36808 -- Required name argument in UniqueConstraint signature. | Jonathan Biemond | |
| By trading ValueError for TypeError for omitted name arguments, we gain a little clarity. | |||
| 2025-12-16 | Fixed #36594 -- Improved UniqueConstraint's nulls_distinct system check message. | Mridul Dhall | |
| Clarified that the nulls_distinct argument is not supported, as opposed to certain values for the argument. Thanks Russell Owen for the report. | |||
| 2025-11-13 | Fixed #36730 -- Fixed constraint validation crash for excluded FK attnames. | Adam Johnson | |
| Regression in e44e8327d3d88d86895735c0e427102063ff5b55. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com> | |||
| 2025-07-23 | Refs #36500 -- Rewrapped long docstrings and block comments via a script. | django-bot | |
| Rewrapped long docstrings and block comments to 79 characters + newline using script from https://github.com/medmunds/autofix-w505. | |||
| 2025-03-31 | Refs #28909 -- Simplified code using unpacking generalizations. | Aarni Koskela | |
| 2025-03-10 | Used _expression_refs_exclude() hook in ↵ | Mariusz Felisiak | |
| CheckConstraint/UniqueConstraint.validate(). | |||
| 2025-02-19 | Fixed #35358, Refs #35234 -- Renamed _check() methods to check() for ↵ | Mariusz Felisiak | |
| constraints. | |||
| 2025-01-15 | Refs #35234 -- Removed CheckConstraint.check per deprecation timeline. | Sarah Boyce | |
| 2025-01-15 | Refs #34355 -- Removed support for positional arguments in BaseConstraint ↵ | Sarah Boyce | |
| per deprecation timeline. | |||
| 2024-12-17 | Fixed #35992, Fixed #35997 -- Added system check for CompositePrimaryKeys in ↵ | Mariusz Felisiak | |
| Meta.indexes/constraints/unique_together. CompositePrimaryKeys are not supported in any of these options. | |||
| 2024-11-28 | Fixed #35038 -- Created AlterConstraint operation. | Salvo Polizzi | |
| 2024-10-10 | Fixed #35103 -- Used provided error code and message when fields is set ↵ | gabn88 | |
| without a condition on UniqueConstraint. | |||
| 2024-09-09 | Refs #373 -- Added Model._is_pk_set() abstraction to check if a Model's PK ↵ | Csirmaz Bendegúz | |
| is set. | |||
| 2024-08-12 | Fixed #35575 -- Added support for constraint validation on GeneratedFields. | Mark Gensler | |
| 2024-08-05 | Refs #35638 -- Avoided wrapping expressions with Value in ↵ | David Sanders | |
| _get_field_value_map() and renamed to _get_field_expression_map(). | |||
| 2024-07-17 | Fixed #35594 -- Added unique nulls distinct validation for expressions. | Simon Charette | |
| Thanks Mark Gensler for the report. | |||
| 2024-07-17 | Refs #30581 -- Made unattached UniqueConstraint(fields) validation testable. | Simon Charette | |
| The logic allowing UniqueConstraint(fields).validate to preserve backward compatiblity with Model.unique_error_message failed to account for cases where the constraint might not be attached to a model which is a common pattern during testing. This changes allows for arbitrary UniqueConstraint(fields) to be tested in isolation without requiring actual models backing them up. Co-authored-by: Mark G <mark.gensler@protonmail.com> | |||
| 2024-05-14 | Fixed #35275 -- Fixed Meta.constraints validation crash on UniqueConstraint ↵ | Mariusz Felisiak | |
| with OpClass(). This also introduces Expression.constraint_validation_compatible that allows specifying that expression should be ignored during a constraint validation. | |||
| 2024-03-30 | Refs #35234 -- Skipped CheckConstraint system checks if not supported. | Mariusz Felisiak | |
| Thanks Tim Graham for the report. Regression in 0fb104dda287431f5ab74532e45e8471e22b58c8. | |||
| 2024-03-01 | Refs #35234 -- Deprecated CheckConstraint.check in favor of .condition. | Simon Charette | |
| Once the deprecation period ends CheckConstraint.check() can become the documented method that performs system checks for BaseConstraint subclasses. | |||
| 2024-02-29 | Refs #35234 -- Moved constraint system checks to Check/UniqueConstraint methods. | Simon Charette | |
| 2023-07-19 | Made UniqueConstraint raise TypeError for type violations. | Simon Charette | |
| 2023-07-19 | Fixed #34701 -- Added support for NULLS [NOT] DISTINCT on PostgreSQL 15+. | Simon Charette | |
| 2023-02-23 | Fixed #34338 -- Allowed customizing code of ValidationError in ↵ | Xavier Fernandez | |
| BaseConstraint and subclasses. | |||
| 2023-02-23 | Refs #33829 -- Added violation_error_message to constraints' __repr__(). | Xavier Fernandez | |
| 2023-02-22 | Fixed #34355 -- Deprecated passing positional arguments to BaseConstraint. | Xavier Fernandez | |
| 2023-01-26 | Fixed #34291 -- Fixed Meta.constraints validation crash on UniqueConstraint ↵ | Mariusz Felisiak | |
| with ordered expressions. Thanks Dan F for the report. Bug in 667105877e6723c6985399803a364848891513cc. | |||
| 2023-01-18 | Refs #34233 -- Used types.NoneType. | Nick Pope | |
| Available since Python 3.10 where it was reintroduced. | |||
| 2022-08-11 | Replaced Expression.replace_references() with .replace_expressions(). | Simon Charette | |
| The latter allows for more generic use cases beyond the currently limited ones constraints validation has. Refs #28333, #30581. | |||
| 2022-08-09 | Fixed #33902 -- Fixed Meta.constraints validation crash with F() expressions. | Mariusz Felisiak | |
| Thanks Adam Zahradník for the report. Bug in 667105877e6723c6985399803a364848891513cc. | |||
| 2022-07-08 | Fixed #33829 -- Made BaseConstraint.deconstruct() and equality handle ↵ | Stéphane "Twidi" Angel | |
| violation_error_message. Regression in 667105877e6723c6985399803a364848891513cc. | |||
| 2022-05-10 | Fixed #30581 -- Added support for Meta.constraints validation. | Gagaro | |
| Thanks Simon Charette, Keryn Knight, and Mariusz Felisiak for reviews. | |||
| 2022-03-16 | Made BaseConstraint importable from django.db.models. | Gagaro | |
| 2022-02-07 | Refs #33476 -- Reformatted code with Black. | django-bot | |
| 2022-02-03 | Refs #33476 -- Refactored problematic code before reformatting by Black. | Mariusz Felisiak | |
| In these cases Black produces unexpected results, e.g. def make_random_password( self, length=10, allowed_chars='abcdefghjkmnpqrstuvwxyz' 'ABCDEFGHJKLMNPQRSTUVWXYZ' '23456789', ): or cursor.execute(""" SELECT ... """, [table name], ) | |||
| 2021-07-12 | Refs #32074 -- Used Enum.repr() format proposed for Python 3.10. | Mariusz Felisiak | |
| The Python's Steering Council decided to revert changes in the Enum module (see https://bugs.python.org/issue44559) and moved them to Python 3.11. Follow up to 5d9b065d3f93de056588dfee6f1776294dd8bab2. Thanks Nick Pope for the review. | |||
| 2021-05-28 | Refs #32779 -- Changed ↵ | Hannes Ljungberg | |
| DatabaseSchemaEditor._unique_sql()/_create_unique_sql() to take fields as second parameter. | |||
| 2021-04-07 | Refs #32074 -- Backported Enum.__repr__() from Python 3.10. | Mariusz Felisiak | |
| Enum.__repr__() was changed in [1], we should use the same format in Python < 3.10. [1] https://bugs.python.org/issue40066 | |||
| 2021-02-23 | Fixed #30916 -- Added support for functional unique constraints. | Hannes Ljungberg | |
| Thanks Ian Foote and Mariusz Felisiak for reviews. | |||
| 2021-02-19 | Fixed #32458 -- Made __repr__() for Index and BaseConstraint subclasses more ↵ | Hannes Ljungberg | |
| consistent. | |||
| 2020-06-29 | Fixed #31745 -- Added error messages when using ↵ | Hannes Ljungberg | |
| UniqueConstraint.include/opclasses with deferrable. | |||
| 2020-06-16 | Fixed #31702 -- Added support for PostgreSQL opclasses in UniqueConstraint. | Hannes Ljungberg | |
| 2020-06-04 | Fixed #30913 -- Added support for covering indexes on PostgreSQL 11+. | Hannes Ljungberg | |
| 2020-04-30 | Fixed #20581 -- Added support for deferrable unique constraints. | Ian Foote | |
| 2019-11-21 | Fixed #30484 -- Added conditional expressions support to CheckConstraint. | Simon Charette | |
| 2019-11-21 | Refs #11964 -- Removed SimpleCol in favor of Query(alias_cols). | Simon Charette | |
| This prevent having to pass simple_col through multiple function calls by defining whether or not references should be resolved with aliases at the Query level. | |||
| 2019-10-01 | Fixed #30651 -- Made __eq__() methods return NotImplemented for not ↵ | ElizabethU | |
| implemented comparisons. Changed __eq__ to return NotImplemented instead of False if compared to an object of the same type, as is recommended by the Python data model reference. Now these models can be compared to ANY (or other objects with __eq__ overwritten) without returning False automatically. | |||
| 2019-01-12 | Fixed #30062 -- Added support for unique conditional constraints. | Paveł Tyślacki | |
| 2019-01-01 | Fixed #30060 -- Moved SQL generation for indexes and constraints to ↵ | Paveł Tyślacki | |
| SchemaEditor. | |||
