Moved philo files into a philo subdirectory and added a setup.py file. Philo can...
[philo.git] / philo / contrib / penfield / templatetags / penfield.py
1 from django import template
2 from django.utils.dates import MONTHS, MONTHS_AP
3
4 register = template.Library()
5
6 def monthname(value):
7         monthnum = int(value)
8         if 1 <= monthnum <= 12:
9                 return MONTHS[monthnum]
10         else:
11                 return value
12
13 register.filter('monthname', monthname)
14
15 def apmonthname(value):
16         monthnum = int(value)
17         if 1 <= monthnum <= 12:
18                 return MONTHS_AP[monthnum]
19         else:
20                 return value
21
22 register.filter('apmonthname', apmonthname)