Commits

Alexander Solovyov  committed 28eb1c4

make datelinks url changing facility more convenient

  • Participants
  • Parent commits 0108ccb

Comments (0)

Files changed (1)

File apps/blog/templatetags/datelinks.py

 register = Library()
 
 @register.filter
-def datelinks(value, tail='_archive'):
+def datelinks(value, prefix=''):
     """
     This filter formats date as "day.month.year" and sets links to
     day/month/year-based archives.
         - month_archive
         - year_archive
     """
-    ctx = {'year': reverse('year'+tail, year=value.year),
-           'month': reverse('month'+tail, year=value.year,
+    ctx = {'year': reverse(prefix+'year_archive', year=value.year),
+           'month': reverse(prefix+'month_archive', year=value.year,
                             month=value.strftime('%m')),
-           'day': reverse('day'+tail, year=value.year,
+           'day': reverse(prefix+'day_archive', year=value.year,
                           month=value.strftime('%m'),
                           day=value.strftime('%d')),
            'date': value}