Upate all uniqueness validation to employ UniqueConstraint classes #10361
Labels
status: accepted
This issue has been accepted for implementation
type: housekeeping
Changes to the application which do not directly impact the end user
Milestone
Proposed Changes
Replace all instances of
unique_together
under a modelMeta
class with a list ofUniqueConstraint
instances defined underconstraints
. Additionally, and custom overrides of a model'svalidate_unique()
method should be removed where possible.Justification
UniqueConstraint
was introduced in Django 4.0 and allows for conditional evaluation. This should allow us to ditch any customvalidate_unique()
logic, such as what is currently defined for the Device model. The Django docs also recommend moving away fromunique_together
in general as it will likely be deprecated in the future.The text was updated successfully, but these errors were encountered: