poulpe/shared/views.py

14 lines
389 B
Python
Raw Normal View History

2017-02-21 16:02:23 +01:00
from django.views.generic import TemplateView
2018-08-26 21:18:51 +02:00
from django.utils import timezone
from event.models import Event
2017-02-21 16:02:23 +01:00
class Home(TemplateView):
2018-08-04 05:38:03 +02:00
template_name = "shared/home.html"
2018-08-26 21:18:51 +02:00
def get_context_data(self):
context = super().get_context_data()
context['events'] = Event.objects.filter(ending_date__gte=timezone.now()).order_by('beginning_date')
return context