X-Git-Url: https://git.mdrn.pl/prawokultury.git/blobdiff_plain/0e199a41c0f2375dbf555452bbdc46162fff8853..91c0733e775b428f3c2b4f614069aa43f4e740fd:/events/views.py?ds=inline diff --git a/events/views.py b/events/views.py index c3c6197..515e92d 100644 --- a/events/views.py +++ b/events/views.py @@ -4,14 +4,17 @@ from events.models import Event def events(request): + events = Event.objects.filter(date_end__gte=datetime.now()) + events = events.filter(**{"published_%s" % request.LANGUAGE_CODE: True}) return render(request, 'events/event_list.html', { - 'object_list': Event.objects.filter(date__gte=datetime.now()) + 'object_list': events, }) def events_past(request): + events = Event.objects.filter(date__lte=datetime.now()).order_by('-date') + events = events.filter(**{"published_%s" % request.LANGUAGE_CODE: True}) return render(request, 'events/event_list.html', { - 'object_list': Event.objects.filter(date__lte=datetime.now() - ).order_by('-date'), + 'object_list': events, 'past': True, })