From bbfd1ea5c51914f1a0b30e578b50e42499a091f0 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Sat, 2 Dec 2023 22:40:20 +0000 Subject: [PATCH] format --- core/forms.py | 1 + core/models.py | 17 ++++++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/forms.py b/core/forms.py index 5b73dd6..b3397dd 100644 --- a/core/forms.py +++ b/core/forms.py @@ -12,6 +12,7 @@ class Meta: model = Team fields = ("name",) + class TeamJoinForm(forms.Form): code = forms.CharField( label=_l("join code"), diff --git a/core/models.py b/core/models.py index 1b48f4f..1b81103 100644 --- a/core/models.py +++ b/core/models.py @@ -208,7 +208,7 @@ class Hunt(models.Model): "e.g. {{this form}}, users will only see 'this form' but can click it to get to the form specified above", max_length=250, ) - + def __str__(self): return self.name @@ -218,21 +218,21 @@ def current_hunt(cls): return cls.objects.get(start__lt=timezone.now(), end__gt=timezone.now()) except cls.DoesNotExist: return None - + def clean(self): """ Due to how this was designed, it is not possible to have multiple hunts running at the same time. This method prevents that from happening. """ overlapping_events = self.objects.filter( - start_date__lte=self.start, - end_date__gte=self.end + start_date__lte=self.start, end_date__gte=self.end ).exclude(pk=self.pk) - + if overlapping_events.exists(): - raise ValidationError('This event overlaps with existing events. Please choose a different time. Or Delete the other event.') - - + raise ValidationError( + "This event overlaps with existing events. Please choose a different time. Or Delete the other event." + ) + class Meta: constraints = [ models.CheckConstraint( @@ -251,7 +251,6 @@ class Meta: name="form_in_ending_text", ), # Ensure there isn't a different hunt running in that timespan - ]