I've a django website set in French in the settings file.
In my template, I've the following entry <a href="/{{ year }}/{{ month|date:"b" }}/">{{ month|date:"F" }}</a>
.
In my URLconf, I have the entry url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{1,2})/$',MonthArchivePostView.as_view())
The problem is that in the template, the date generated is in French (for example, for February, I've got <a href="/2012/fév/">Février</a>
) but the url expects the English version (/2012/feb/
).
I don't mind having the dates in the url in English or in French, I just need to have the same generated in with the template and expected in the URLconf file.
Thank you
Update quick-fix-not-really-a-solution : use the m
format everywhere instead of b
to have /02/
instead of /feb/
So in the urls.py
url(r'^(?P<year>\d{4})/(?P<month>\d{1,2})/$',
MonthArchivePostView.as_view()
),
and in the generic views
class MonthArchivePostView(dates.MonthArchiveView):
model = Post
month_format = '%m'
date_field = 'publish'