How to use the eventy.models.EventTime.objects.all function in eventy

To help you get started, we’ve selected a few eventy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github powellc / django-eventy / eventy / models.py View on Github external
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