Is there an easy way to get the URL to a Django date-based generic view (specifically object_detail) from a template?
Given a URL conf like this
url(r'^posts/(?P<year>\d\d\d\d)/(?P<month>\d\d)/(?P<day>\d\d)/(?P<slug>[\w-]+)$', 'date_based.object_detail', detail_info, name='blog-post-detail')
My understanding is that I would need to do something like this
{% url blog_post_detail year=post.date.year.str,month=post.date.month,day=post.date.day,slug=post.slug %}
Except that
- The year, month and day need to be formatted as strings
- There has to be an easier way
If anyone has input on either of these it would be much appreciated
Thanks