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_query_set(self):
return super(UpcomingManager, self).get_query_set().filter(start__gte=datetime.now())
class EventTime(models.Model):
"""EventTime model
This model does most of the heavy lifting as to whether """
event = models.ForeignKey(Event, related_name='event_times')
start = models.DateTimeField()
end = models.DateTimeField(blank=True, null=True)
place = models.ForeignKey(Place, blank=True, null=True)
place_string = models.CharField(_('One-off place'), max_length=200, blank=True)
is_all_day = models.BooleanField(default=False)
notes = models.TextField(_('Notes'), blank=True, null=True)
slug = models.SlugField(_('Event slug'), blank=True, editable=False)
objects = models.Manager()
upcoming_objects = UpcomingManager()
class Meta:
verbose_name = _('event time')
verbose_name_plural = _('event times')
get_latest_by = 'start'
def __init__(self, *args, **kwargs):
super (EventTime, self).__init__(*args, **kwargs)
self._next = None
self._previous = None
@property
def is_past(self):
NOW = datetime.now().date
if self.start < NOW:
return True