From d292d1daf1a26d14e8e1ec4914e74e6a5d216812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Mon, 11 May 2015 16:24:40 +0200 Subject: [PATCH] misc: don't display cells to anonymous users --- lingo/models.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lingo/models.py b/lingo/models.py index ab32247..aa3648b 100644 --- a/lingo/models.py +++ b/lingo/models.py @@ -118,6 +118,8 @@ class LingoBasketCell(CellBase): return Regie.objects.count() > 0 def is_relevant(self, context): + if not context['request'].user.is_authenticated(): + return False items = BasketItem.objects.filter( user=context['request'].user, payment_date__isnull=True ).exclude(cancellation_date__isnull=False) @@ -143,6 +145,8 @@ class LingoRecentTransactionsCell(CellBase): return Regie.objects.count() > 0 def is_relevant(self, context): + if not context['request'].user.is_authenticated(): + return False transactions = Transaction.objects.filter( user=context['request'].user, start_date__gte=timezone.now()-datetime.timedelta(days=7))