Skip to content

Commit

Permalink
Ensure start and end times are set.
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonLovesDoggo committed Aug 22, 2024
1 parent b96c317 commit ab0020b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,11 @@ def clean(self):
This method prevents that from happening.
"""

if self.start is None or self.end is None:
raise ValidationError("Start and end times must be set.")

overlapping_events = Hunt.objects.filter(
start__lte=self.start, end__gte=self.end # todo fix
start__lte=self.start, end__gte=self.end
).exclude(pk=self.pk)
if overlapping_events.exists():
raise ValidationError(
Expand Down

0 comments on commit ab0020b

Please sign in to comment.