Hey guys,
Maybe i am missing something, but according to the django docs (1.2), i have setup my URLS, models exactly as specified to ensure i am not hard-coding urls returned for get_absolute_url.
Here's what i have:
in urls.py
urlpatterns = patterns('django.views.generic.list_detail',
url(r'^$','object_list',
{ 'queryset': product.objects.all(),
'template_name': 'products/list.html',
},
name='product_list'),
url(r'^(?P<slug>[-\w]+)/$','object_detail',
{ 'queryset': product.objects.all(),
'template_name': 'products/detail.html',
},
name='product_detail'),
)
in models.py
@models.permalink
def get_absolute_url(self):
return ('product_detail', (), {'slug': str(self.slug)})
The method returns an empty string in the templates, and from the shell it gives an error.
NoReverseMatch: Reverse for 'product_detail' with arguments '()' and keyword arguments '{'slug': 'dd-d--'}' not found.
This should resolve should it not, since urls.py has a name : product_detail