set year to None if no posts
This commit is contained in:
@@ -63,7 +63,9 @@ def index(request):
|
|||||||
fet_meeting_only,
|
fet_meeting_only,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
last_post_year = Post.objects.get_queryset().first().date.year
|
last_year = Post.objects.get_queryset().first()
|
||||||
|
if last_year:
|
||||||
|
last_post_year = last_year.date.year
|
||||||
now_year = timezone.now().year
|
now_year = timezone.now().year
|
||||||
|
|
||||||
# if the last post is a year old or more, then set year to it
|
# if the last post is a year old or more, then set year to it
|
||||||
@@ -71,6 +73,8 @@ def index(request):
|
|||||||
year = last_post_year
|
year = last_post_year
|
||||||
else:
|
else:
|
||||||
year = now_year
|
year = now_year
|
||||||
|
else:
|
||||||
|
year = None
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
'year': year,
|
'year': year,
|
||||||
|
|||||||
Reference in New Issue
Block a user