from django.views.generic import TemplateView from django.utils import timezone from event.models import Event class Home(TemplateView): template_name = "shared/home.html" 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