Make entry intersection check exclusive

Closes #263
This commit is contained in:
Christopher C. Wells 2021-08-17 05:59:08 -07:00
parent 3922966815
commit fad8f1500e
1 changed files with 1 additions and 1 deletions

View File

@ -51,7 +51,7 @@ def validate_unique_period(queryset, model):
if model.id:
queryset = queryset.exclude(id=model.id)
if model.start and model.end:
if queryset.filter(start__lte=model.end, end__gte=model.start):
if queryset.filter(start__lt=model.end, end__gt=model.start):
raise ValidationError(
_('Another entry intersects the specified time period.'),
code='period_intersection')