diff options
Diffstat (limited to 'website')
-rw-r--r-- | website/templatetags/nice_bar.py | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/website/templatetags/nice_bar.py b/website/templatetags/nice_bar.py index f7fd78c..3abc539 100644 --- a/website/templatetags/nice_bar.py +++ b/website/templatetags/nice_bar.py @@ -8,18 +8,21 @@ register = template.Library() # Showing/Hiding nice-bar on pages def is_nice_bar_visible(request): - if request.path == '/': - return True - elif "Oscad" in request.path: - return True - elif "/question/" in request.path: - try: - question_id = request.path[1:-1].split('/') - question_id = int(question_id[1]) - question = Question.objects.get(pk=question_id) - if question.category == "Oscad": - return True - except: - return False + try: + if request.path == '/': + return True + elif "Oscad" in request.path: + return True + elif "/question/" in request.path: + try: + question_id = request.path[1:-1].split('/') + question_id = int(question_id[1]) + question = Question.objects.get(pk=question_id) + if question.category == "Oscad": + return True + except: + return False + except: + return False return False register.filter('is_nice_bar_visible', is_nice_bar_visible) |