My models:
Story:
categories = models.ManyToManyField(Category)
Category: name | slug
My urls:
(r'^(?P<cat_slug>.*)/$', 'news.views.archive_category'),
And in views, I use:
def archive_category(request, cat_slug):
entry = News.objects.get( categories__slug=cat_slug )
return render_to_response('news_archive_category.html', {'entry':entry, })
It has something wrong if I have a story of two or more category. Please help me. Many thanks!