From 3bb97b87eb3f3afd17c58d98b1ca1d70420c992a Mon Sep 17 00:00:00 2001
From: DylannCordel <d.cordel@webu.coop>
Date: Fri, 13 Jan 2017 15:36:34 +0100
Subject: [PATCH] fix when no news is found

---
 newsbox/views.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/newsbox/views.py b/newsbox/views.py
index ad7c5f7..4dcc04d 100644
--- a/newsbox/views.py
+++ b/newsbox/views.py
@@ -42,8 +42,9 @@ class NewsboxBaseArchiveView(NewsboxPublishedMixinView):
             'title_url': '',
             'newsbox_opts': self.model._newsbox_meta,
             'date_list_period': self.date_list_period,
-            'current_date': context['object_list'].first().newsbox_publication_start_date
         })
+        if context['object_list']:
+            context['current_date'] = context['object_list'][0].newsbox_publication_start_date
         return context
 
 
-- 
GitLab