aboutsummaryrefslogtreecommitdiff
path: root/templatetags
diff options
context:
space:
mode:
Diffstat (limited to 'templatetags')
-rw-r--r--templatetags/dt_week.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/templatetags/dt_week.py b/templatetags/dt_week.py
new file mode 100644
index 0000000..714bc0d
--- /dev/null
+++ b/templatetags/dt_week.py
@@ -0,0 +1,13 @@
+from django import template
+
+import datetime
+
+register = template.Library()
+
+@register.filter
+def dt_week(dt):
+ return dt.isocalendar()[1]
+
+@register.filter
+def dt_prettyprint(dt):
+ return "{0}/{1:02d}/{2:02d}".format(dt.year, dt.month, dt.day)