From 4dcc112593c84783b6d17cf3b7f93b1c6342b25d Mon Sep 17 00:00:00 2001 From: Andrey Date: Mon, 24 Apr 2017 15:27:59 +0300 Subject: [PATCH] customer: don't fail in context_processor on admins who don't have profile --- project/customer/context_processors.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/project/customer/context_processors.py b/project/customer/context_processors.py index 8d6cafb..db8b58a 100644 --- a/project/customer/context_processors.py +++ b/project/customer/context_processors.py @@ -17,6 +17,13 @@ cache_duration = 3600 def license_check_soon_ends(request): + try: + # admins don't have profile + if not request.user.profile: + return { } + except AttributeError as e: + return { } + try: license_cookie = request.COOKIES.get('close_message_license') license_15days = cache.get('license_15_%s' % (request.user.username,), None)