Problem with multi tags
If i have url "/tagged/something/"
then it is good, but if i have "/tagged/something1-something2/"
it tells me that that page is not found and url didn't matching anything.
urls.py
url(r'^tagged/(?P<tags>\w+)/$', 'show_tagged'),
views.py
def show_tagged(request, tags):
tags = tags.repla开发者_开发知识库ce(',', '').split('-')
items = TaggedItem.objects.get_intersection_by_model(Item, tags)
return render_to_response('tagged.html', {'items': items}, context_instance=RequestContext(request))
How can i fix this?
Can you try changing your regex? I think the following one will work:
url(r'^tagged/(?P<tags>[\w-]+)/$', 'show_tagged'),
精彩评论