aboutsummaryrefslogtreecommitdiff
path: root/templatetags
diff options
context:
space:
mode:
authorAlban Gruin2017-01-20 14:37:49 +0100
committerAlban Gruin2017-01-20 14:37:49 +0100
commita4c9f9027c443a32ff3475dc292c7495f685b651 (patch)
treefa5bb432284ad6964519e05c79e93cad4a45aae3 /templatetags
parent5349208724305c9ec1ea4ab1c51af9969dc586e0 (diff)
Affichage des emplois du temps par semaine
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)