aboutsummaryrefslogtreecommitdiffstats
path: root/tools/templatetags
diff options
context:
space:
mode:
authorWeitian LI <liweitianux@gmail.com>2014-06-24 23:09:43 +0800
committerWeitian LI <liweitianux@gmail.com>2014-06-24 23:09:43 +0800
commit88c4fa2c87138d9f4707ad7193662953f9de725f (patch)
tree0185998a92184d0c5b76513d0c94774a06274432 /tools/templatetags
parentaf609a29bee3bc17800cf061c66b6eabcf18234f (diff)
downloaddjango-skaschool-88c4fa2c87138d9f4707ad7193662953f9de725f.tar.bz2
Added schedule.html template for app 'schedule'.
* added 'schedule.views.ScheduleView' * added 'schedule.html' template, with 'schedule.css' and 'schedule.js' * added 'schedule.urls', updated django_skaschool.urls * added tools/templatetags/dict_utils.py * converted schedule models to south-based * removed original 'page/templates/page/program.html', related urls * updated navbar.html
Diffstat (limited to 'tools/templatetags')
-rw-r--r--tools/templatetags/dict_utils.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/templatetags/dict_utils.py b/tools/templatetags/dict_utils.py
new file mode 100644
index 0000000..5a81c79
--- /dev/null
+++ b/tools/templatetags/dict_utils.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+#
+# utilities to deal with dictionary in template
+#
+
+from django import template
+
+
+register = template.Library()
+
+@register.filter
+def dictkey(d, key):
+ try:
+ value = d[key]
+ except KeyError:
+ from django.conf import settings
+ value = settings.TEMPLATE_STRING_IF_INVALID
+ return value
+