我已经在上配置了url
url(r'^tags/(?P<slug>\d+)/$', TagsDetailList.as_view(), name = 'tag_detail'),
现在如果我输入url/tags/bubble(它在tag\列表中给出,并且有一个相关的对象) 后面应该加载TagsDetailList视图吗?你知道吗
class TagsDetailList(ListView):
queryset = Link.objects.filter(tags__name__in=['request.slug'])
template_name = "tags_detail_list.html"
但是它没有到达视图,因为我得到页面没有找到错误。为什么?你知道吗
Remote Address:127.0.0.1:8000
Request URL:http://127.0.0.1:8000/tags/bubble
Request Method:GET
Status Code:404 NOT FOUND
Request Headersview source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip,deflate,sdch
Accept-Language:de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4,it;q=0.2
Cache-Control:max-age=0
Connection:keep-alive
Cookie:csrftoken=yY4hznFWlnvDbvvgBFWupYsrDFse32Pe; sessionid=0zx2ot6962wpx66ovmlk0z08gd5zvxho
DNT:1
Host:127.0.0.1:8000
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36
Response Headersview source
Content-Type:text/html
Date:Sun, 26 Oct 2014 10:47:50 GMT
Server:WSGIServer/0.1 Python/2.7.6
Vary:Cookie
X-Frame-Options:SAMEORIGIN
我不明白。谢谢
\d
只与数字匹配。你需要\w
。你知道吗相关问题 更多 >
编程相关推荐