mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
FIX: Prevent setting access time after start time
Cherry pick of d274ea4606. Will close #405.
This commit is contained in:
@@ -463,6 +463,12 @@ 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:
|
||||
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.')
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
"""Call :meth:`full_clean` before saving."""
|
||||
|
||||
Reference in New Issue
Block a user