From 76d4321a1e621ec52ad2dc6d5fc540c56c41541a Mon Sep 17 00:00:00 2001 From: Patrick Mayr Date: Mon, 24 Jan 2022 13:08:25 +0000 Subject: [PATCH] set current year as initial --- fet2020/posts/views.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fet2020/posts/views.py b/fet2020/posts/views.py index 9cb18f3d..6fc3e7ac 100644 --- a/fet2020/posts/views.py +++ b/fet2020/posts/views.py @@ -8,6 +8,7 @@ from django.contrib import messages from django.http import HttpResponse, Http404 from django.shortcuts import render from django.template.loader import render_to_string +from django.utils import timezone from authentications.decorators import authenticated_user from documents.api import get_pad_link @@ -62,8 +63,12 @@ def index(request): fet_meeting_only, ) else: - form = PostSearchForm() - posts = Post.objects.date_sorted_list(public_only) + data = { + 'year': timezone.now().year, + } + + form = PostSearchForm(data) + posts = Post.objects.date_filtered_list(public_only, data["year"]) if posts: taglist = map(lambda post: post.tags, posts)