I have list of events. Using ListView to render them.
In models.py
def event_date_time(self):
event_date_time = datetime.combine(self.event_date, self.event_time)
return event_date_time
In ListView
i also have now= datetime.utcnow()
Need to add a filter to queryset.
if now > event_date_time:
#don't render that event
else:
#render
You cannot use a model function in Django filtering. You should use DateTimeField to store event_date and event_time in one attribute. Then, in your ListView, override the 'get_queryset' function like so: