I have a Django model with a start and end date range. I want to enforce validation so that no two records have overlapping date ranges. What's the simplest way to implement this so that I don't have to repeat myself writing this logic?
e.g. I don't want to re-implement this logic in a Form and a ModelForm
and an admin form and the model's overridden save()
.
As far as I know, Django doesn't make it easy to globally enforce these types of criteria.
Googling hasn't been very helpful, since "model validation" typically refers to validating specific model fields, and not the entire model contents, or relations between fields.