Commits

David Jean Louis  committed b4cce54

fixed error (global name 'bookmark' is not defined) when menu has no BookmarkMenuItem

  • Participants
  • Parent commits 3e37f63

Comments (0)

Files changed (1)

File admin_tools/menu/templatetags/admin_tools_menu_tags.py

 
     menu.init_with_context(context)
     has_bookmark_item = False
+    bookmark = None
     if len([c for c in menu.children if isinstance(c, BookmarkMenuItem)]) > 0:
         has_bookmark_item = True
         url = context['request'].get_full_path()
         try:
             bookmark = Bookmark.objects.filter(user=context['request'].user, url=url)[0]
-        except IndexError:
-            bookmark = None
+        except:
+            pass
 
     context.update({
         'template': menu.template,