From 16692b692bd8627bad9f42c7cdf29161bd664779 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] lingo: don't display cells to anonymous users --- combo/apps/lingo/models.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/combo/apps/lingo/models.py b/combo/apps/lingo/models.py index ab32247a..aa3648b3 100644 --- a/combo/apps/lingo/models.py +++ b/combo/apps/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))