- return reverse('entries_by_tag', urlconf=self, kwargs={'tag_slugs': obj.slug})
- elif isinstance(obj, (str, unicode)):
- split_obj = obj.split(':')
- if len(split_obj) > 1:
- kwargs = {}
- try:
- kwargs.update({'year': str(int(split_obj[1])).zfill(4)})
- if len(split_obj) > 2:
- kwargs.update({'month': str(int(split_obj[2])).zfill(2)})
- if len(split_obj) > 3:
- kwargs.update({'day': str(int(split_obj[3])).zfill(2)})
- return reverse('entries_by_day', urlconf=self, kwargs=kwargs)
- return reverse('entries_by_month', urlconf=self, kwargs=kwargs)
- return reverse('entries_by_year', urlconf=self, kwargs=kwargs)
- except:
- pass
+ return 'entries_by_tag', [], {'tag_slugs': obj.slug}
+ elif isinstance(obj, (date, datetime)):
+ kwargs = {
+ 'year': str(obj.year).zfill(4),
+ 'month': str(obj.month).zfill(2),
+ 'day': str(obj.day).zfill(2)
+ }
+ return 'entries_by_day', [], kwargs