Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_previous_event_time(self):
"""Determines the previous event time"""
if not self._previous:
try:
qs = EventTime.objects.all().exclude(id__exact=self.id)
event_time= qs.filter(start__lte=self.start).order_by('-start')[0]
except (EventTime.DoesNotExist, IndexError):
event_time = None
self._previous = event_time
return self._previous