2 Penfield supplies two template filters:
4 .. templatefilter:: monthname
8 Returns the name of a month with the supplied numeric value.
10 .. templatefilter:: apmonthname
14 Returns the Associated Press abbreviated month name for the supplied numeric value.
17 from django import template
18 from django.utils.dates import MONTHS, MONTHS_AP
20 register = template.Library()
33 register.filter('monthname', monthname)
35 def apmonthname(value):
42 return MONTHS_AP[value]
46 register.filter('apmonthname', apmonthname)