Fix error when user is not authenticated.
authorAlexandre Segura <mex.zktk@gmail.com>
Thu, 18 May 2017 12:07:35 +0200
changeset 510 be39a4b2db25
parent 509 efa81cbd61e9
child 511 3fd34eef6516
Fix error when user is not authenticated.
src/iconolab/templatetags/iconolab_tags.py
--- a/src/iconolab/templatetags/iconolab_tags.py	Thu May 18 11:06:56 2017 +0200
+++ b/src/iconolab/templatetags/iconolab_tags.py	Thu May 18 12:07:35 2017 +0200
@@ -77,4 +77,6 @@
 @register.assignment_tag(takes_context=True)
 def is_bookmarked(context, image):
     request = context['request']
+    if not request.user.is_authenticated():
+        return False
     return image.is_bookmarked_by(request.user)