diff --git a/RIGS/forms.py b/RIGS/forms.py index 59e9eb01..9ff013b5 100644 --- a/RIGS/forms.py +++ b/RIGS/forms.py @@ -200,7 +200,6 @@ class EventChecklistForm(forms.ModelForm): related_models = { 'venue': models.Venue, - 'power_mic': models.Profile, } class Meta: diff --git a/RIGS/models.py b/RIGS/models.py index df666fad..1ea40818 100644 --- a/RIGS/models.py +++ b/RIGS/models.py @@ -482,6 +482,15 @@ class Event(models.Model, RevisionMixin): else: return bool(self.purchase_order) + @property + def can_check_in(self): + earliest = self.earliest_time + if isinstance(self.earliest_time, datetime.date): + earliest = datetime.datetime.combine(self.start_date, datetime.time(00, 00)) + tz = pytz.timezone(settings.TIME_ZONE) + earliest = tz.localize(earliest) + return not self.dry_hire and earliest <= timezone.now() + objects = EventManager() def get_absolute_url(self): @@ -921,8 +930,11 @@ class EventCheckIn(models.Model): end_time = models.DateTimeField(null=True) def clean(self): - if self.end_time < self.time: - raise ValidationError("May not check out before you've checked in. Please invent time travel and retry.") + sass = " Please invent time travel and retry." + if self.time > timezone.now(): + raise ValidationError("May not check in in the future." + sass) + if self.end_time and self.end_time < self.time: + raise ValidationError("May not check out before you've checked in." + sass) def active(self): return end_time is not None diff --git a/RIGS/templates/event_detail.html b/RIGS/templates/event_detail.html index d1c873d7..c7965434 100644 --- a/RIGS/templates/event_detail.html +++ b/RIGS/templates/event_detail.html @@ -2,6 +2,7 @@ {% load markdown_tags %} {% load button from filters %} +{% load static %} {% block content %}