summaryrefslogtreecommitdiff
path: root/website
diff options
context:
space:
mode:
authorJayaram Pai2014-04-28 20:16:48 +0530
committerJayaram Pai2014-04-28 20:16:48 +0530
commit5c8db8b5a3e363be63f21700149ef5891410374c (patch)
treebe2a29678f9bbd7a3b253d8839eac1c34ee51718 /website
parent7c3c9f3a0591b4b785e30b22c0cf0d2b33c17b1e (diff)
downloadFOSSEE-Forum-5c8db8b5a3e363be63f21700149ef5891410374c.tar.gz
FOSSEE-Forum-5c8db8b5a3e363be63f21700149ef5891410374c.tar.bz2
FOSSEE-Forum-5c8db8b5a3e363be63f21700149ef5891410374c.zip
Oscad workshop notification added.
Diffstat (limited to 'website')
-rw-r--r--website/templatetags/nice_bar.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/website/templatetags/nice_bar.py b/website/templatetags/nice_bar.py
new file mode 100644
index 0000000..f7fd78c
--- /dev/null
+++ b/website/templatetags/nice_bar.py
@@ -0,0 +1,25 @@
+import re
+
+from django import template
+
+from website.models import Question, Answer
+
+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
+ return False
+register.filter('is_nice_bar_visible', is_nice_bar_visible)