Write a function in an event named in_future that will compare event.date with datetime.now() and use it in the template. Do not add unnecessary logic to the template.
Or, as Manoah suggested, you can create your own in_the_future filter and call it:
{% if event.date|in_the_future %}
It's simple:
@register.filter def in_the_future(value): return value > datetime.now()
source share