Moved philo files into a philo subdirectory and added a setup.py file. Philo can...
[philo.git] / philo / contrib / penfield / templatetags / penfield.py
diff --git a/philo/contrib/penfield/templatetags/penfield.py b/philo/contrib/penfield/templatetags/penfield.py
new file mode 100644 (file)
index 0000000..99e358c
--- /dev/null
@@ -0,0 +1,22 @@
+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 apmonthname(value):
+       monthnum = int(value)
+       if 1 <= monthnum <= 12:
+               return MONTHS_AP[monthnum]
+       else:
+               return value
+
+register.filter('apmonthname', apmonthname)