]> git.0d.be Git - panikweb.git/commitdiff
add variable with unexpired news only
authorFrédéric Péters <fpeters@0d.be>
Wed, 19 Jan 2022 09:05:47 +0000 (10:05 +0100)
committerFrédéric Péters <fpeters@0d.be>
Wed, 19 Jan 2022 09:05:47 +0000 (10:05 +0100)
panikweb/views.py

index 8b7cc7c9928e37107b4a9dfd759d35daffbcc5d2..a712c5571494bc65754b501daa0810cba9096ca7 100644 (file)
@@ -693,6 +693,11 @@ class News(TemplateView):
             .order_by('-date')[:10]
         )
         context['news'] = NewsItem.objects.exclude(date__gt=date.today()).order_by('-date')
+        context['news_not_expired'] = (
+            NewsItem.objects.exclude(date__gt=date.today())
+            .exclude(expiration_date__lt=date.today())
+            .order_by('-date')
+        )
         return context