Changes between Initial Version and Version 1 of Ticket #36880, comment 1
- Timestamp:
- Jan 23, 2026, 10:49:28 AM (2 hours ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #36880, comment 1
initial v1 3 3 What should be done instead is find a way to have `django.db.models.options.Options.total_unique_constraints` include such constraint in a way that doesn't couple `contrib.postgres` with core. 4 4 5 A potential solution could be to introduce a `Constraint.totally_unique_for_fields -> set[tuple[str]] | None` method which is implemented by `UniqueConstraint` and `ExclusionConstraint`. 5 A potential solution could be to introduce a `Constraint.totally_unique_for_fields: set[tuple[str]] | None` property which is implemented by `UniqueConstraint` and `ExclusionConstraint` [https://github.com/django/django/blob/2351c1b12cc9cf82d642f769c774bc3ea0cc4006/django/db/models/options.py#L977C9-L990 over the introspection logic that currently exists]. 6 7 That might call for a `Options.unique_together_fields: set[tuple[str]]` that combine `Field.unique`, `Options.unique_together` and `Constraint.totally_unique_for_fields` so interested parties don't have to check of them every time.