Closed
Description
Proposed Changes
Replace all instances of unique_together
under a model Meta
class with a list of UniqueConstraint
instances defined under constraints
. Additionally, and custom overrides of a model's validate_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 custom validate_unique()
logic, such as what is currently defined for the Device model. The Django docs also recommend moving away from unique_together
in general as it will likely be deprecated in the future.