if no input, all posts are shown
This commit is contained in:
@@ -42,25 +42,9 @@ def index(request):
|
||||
form.cleaned_data["fet_meeting_only"],
|
||||
)
|
||||
else:
|
||||
last_year = Post.objects.get_queryset().first()
|
||||
if last_year:
|
||||
last_post_year = last_year.date.year
|
||||
now_year = timezone.now().year
|
||||
|
||||
# if the last post is a year old or more, then set year to it
|
||||
if last_post_year < now_year:
|
||||
year = last_post_year
|
||||
else:
|
||||
year = now_year
|
||||
else:
|
||||
year = None
|
||||
|
||||
data = {
|
||||
"year": year,
|
||||
}
|
||||
|
||||
form = PostSearchForm(data)
|
||||
posts = Post.objects.date_filtered_list(public_only, data["year"])
|
||||
# If no input, all posts are shown.
|
||||
form = PostSearchForm()
|
||||
posts = Post.objects.date_filtered_list(public_only)
|
||||
|
||||
context = {
|
||||
"formset": form,
|
||||
|
||||
Reference in New Issue
Block a user