i have problem with django’s named urls which is included with include keyword. In my main urls.py i have url(r'^blog/$', include('blog.urls', namespace='blog')), in my blog.urls i have url(r'^(?P<slug>[-\w]+)/$', BlogDetailView.as_view(template_name='blog_detail.html'), name='blog_detail'), and i want to use that named url as return statment for get_absolute_url() function in my model. If i type
@models.permalink
def get_absolute_url(self):
return('blog_detail', (), {'slug':self.slug})
It doesnt work… If i remove inculde statment and put in my url all the blog_detail url, it works like a charm, what can i do to fix?
Thanks in advice…
You’re not prefixing the namespace. Use the following instead: