Merge branch 'master' of git://github.com/kgodey/philo into kgodey
authorJoseph Spiros <joseph.spiros@ithinksw.com>
Thu, 8 Jul 2010 00:32:55 +0000 (20:32 -0400)
committerJoseph Spiros <joseph.spiros@ithinksw.com>
Thu, 8 Jul 2010 00:32:55 +0000 (20:32 -0400)
contrib/penfield/templatetags/__init__.py [new file with mode: 0644]
contrib/penfield/templatetags/penfield.py [new file with mode: 0644]

diff --git a/contrib/penfield/templatetags/__init__.py b/contrib/penfield/templatetags/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/contrib/penfield/templatetags/penfield.py b/contrib/penfield/templatetags/penfield.py
new file mode 100644 (file)
index 0000000..3f4c2f4
--- /dev/null
@@ -0,0 +1,23 @@
+from django import template
+from django.utils.dates import MONTHS, MONTHS_AP
+
+register = template.Library()
+
+def monthname(value):
+       monthnum = int(value)
+       if 1 <= monthnum <= 12:
+               return MONTHS[monthnum]
+       else:
+               return value
+
+register.filter('monthname', monthname)
+
+def ap_monthname(value):
+       monthnum = int(value)
+       if 1 <= monthnum <= 12:
+               return MONTHS_AP[monthnum]
+       else:
+               return value
+
+register.filter('monthname', monthname)
+register.filter('ap_monthname', ap_monthname)