using DateDetailView with a translated slug: possible bug?

20 views
Skip to first unread message

Roberto López López

unread,
Oct 8, 2013, 6:29:00 AM10/8/13
to django-mode...@googlegroups.com


Hi,

I hame some trouble using DateDetailView in my project. In my urls.py I am using DateDetailView from django.views.generic.dates:
urlpatterns = patterns('django.views.generic.date_based',
    url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$',
        DateDetailView.as_view(month_format = '%m', date_field='pub_date', model=News), name='news_detail'),
)

I have previously defined the slug field to be translated (English and Norwegian), and this is reflected on the database with the fields slug, slug_en and slug_nb.

When I browse to this url I can see in the server log that django is not taking into account my translated slug (slug_nb in this case). Could this be a bug?
DEBUG 2013-10-08 11:22:54,120 util 8450 140000789985024 (0.002) SELECT "news_news"."id", "news_news"."title", "news_news"."title_en", "news_news"."title_nb", "news_news"."slug", "news_news"."slug_en", "news_news"."slug_nb", "news_news"."excerpt", "news_news"."excerpt_en", "news_news"."excerpt_nb", "news_news"."content", "news_news"."content_en", "news_news"."content_nb", "news_news"."is_published", "news_news"."pub_date", "news_news"."link" FROM "news_news" WHERE ("news_news"."is_published" = true  AND "news_news"."pub_date" <= E'2013-10-08 11:22:54.095249+02:00'  AND "news_news"."pub_date" >= E'2013-10-05 00:00:00+02:00'  AND "news_news"."pub_date" < E'2013-10-06 00:00:00+02:00'  AND "news_news"."slug" = E'second-news-second-news' ); args=(True, u'2013-10-08 11:22:54.095249+02:00', u'2013-10-05 00:00:00+02:00', u'2013-10-06 00:00:00+02:00', u'second-news-second-news')
WARNING 2013-10-08 11:22:54,120 base 8450 140000789985024 Not Found: /nb/news/2013/10/05/second-news-second-news/
[08/Oct/2013 11:22:54] "GET /nb/news/2013/10/05/second-news-second-news/ HTTP/1.1" 404 1685

Thanks for your help!

Roberto


Reply all
Reply to author
Forward
0 new messages