From d5baf6b3563a4e77fd4b027dfba38b1a416e7313 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:55:54 +0200 Subject: [PATCH] misc: fix testing environment where no user is available --- lingo/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lingo/models.py b/lingo/models.py index aa3648b..9a3479b 100644 --- a/lingo/models.py +++ b/lingo/models.py @@ -118,7 +118,7 @@ class LingoBasketCell(CellBase): return Regie.objects.count() > 0 def is_relevant(self, context): - if not context['request'].user.is_authenticated(): + if not (getattr(context['request'], 'user', None) and context['request'].user.is_authenticated()): return False items = BasketItem.objects.filter( user=context['request'].user, payment_date__isnull=True @@ -145,7 +145,7 @@ class LingoRecentTransactionsCell(CellBase): return Regie.objects.count() > 0 def is_relevant(self, context): - if not context['request'].user.is_authenticated(): + if not (getattr(context['request'], 'user', None) and context['request'].user.is_authenticated()): return False transactions = Transaction.objects.filter( user=context['request'].user,