X-Git-Url: https://git.mdrn.pl/prawokultury.git/blobdiff_plain/44090c986d9a16f6913047c25319c446bb9308ad..fa8909f95f314f1bea5f52b81381304c68a75417:/events/views.py?ds=sidebyside diff --git a/events/views.py b/events/views.py index 60f00ef..c3c6197 100644 --- a/events/views.py +++ b/events/views.py @@ -1 +1,17 @@ -# Create your views here. +from datetime import datetime +from django.shortcuts import render +from events.models import Event + + +def events(request): + return render(request, 'events/event_list.html', { + 'object_list': Event.objects.filter(date__gte=datetime.now()) + }) + + +def events_past(request): + return render(request, 'events/event_list.html', { + 'object_list': Event.objects.filter(date__lte=datetime.now() + ).order_by('-date'), + 'past': True, + })