Really ought to get a pre-commit hook for pep8...

This commit is contained in:
2020-05-25 13:40:53 +01:00
parent 18fde7c16a
commit 2f7389d8bb
4 changed files with 25 additions and 25 deletions

View File

@@ -234,7 +234,7 @@ class EventManager(models.Manager):
(models.Q(dry_hire=True, start_date__gte=timezone.now().date()) & ~models.Q(
status=Event.CANCELLED)) | # Active dry hire
(models.Q(dry_hire=True, checked_in_by__isnull=True) & (
models.Q(status=Event.BOOKED) | models.Q(status=Event.CONFIRMED))) | # Active dry hire GT
models.Q(status=Event.BOOKED) | models.Q(status=Event.CONFIRMED))) | # Active dry hire GT
models.Q(status=Event.CANCELLED, start_date__gte=timezone.now().date()) # Canceled but not started
).order_by('start_date', 'end_date', 'start_time', 'end_time', 'meet_at').select_related('person',
'organisation',
@@ -269,7 +269,7 @@ class EventManager(models.Manager):
(models.Q(dry_hire=True, start_date__gte=timezone.now().date(), is_rig=True) & ~models.Q(
status=Event.CANCELLED)) | # Active dry hire
(models.Q(dry_hire=True, checked_in_by__isnull=True, is_rig=True) & (
models.Q(status=Event.BOOKED) | models.Q(status=Event.CONFIRMED))) # Active dry hire GT
models.Q(status=Event.BOOKED) | models.Q(status=Event.CONFIRMED))) # Active dry hire GT
).count()
return event_count
@@ -463,9 +463,9 @@ class Event(models.Model, RevisionMixin):
hasStartAndEnd = self.has_start_time and self.has_end_time
if startEndSameDay and hasStartAndEnd and self.start_time > self.end_time:
raise ValidationError('Unless you\'ve invented time travel, the event can\'t finish before it has started.')
if self.access_at is not None:
if self.access_at.date() > self.start_date:
if self.access_at.date() > self.start_date:
raise ValidationError('Regardless of what some clients might think, access time cannot be after the event has started.')
elif self.start_time is not None and self.start_date == self.access_at.date() and self.access_at.time() > self.start_time:
raise ValidationError('Regardless of what some clients might think, access time cannot be after the event has started.')