django中基于GET请求参数的定向
我用的是c.html(http://localhost:8000/practice/c)然后我单击一个链接,将我的url更改为 这是url.pydjango中基于GET请求参数的定向,django,django-urls,Django,Django Urls,我用的是c.html(http://localhost:8000/practice/c)然后我单击一个链接,将我的url更改为 这是url.py url(r'^$', prac_c), url(r'^q=\d',fetch_c), 这是views.py def prac_c(request): return render_to_response('subject/c.html', {"problem_list":problem_list}) def fetch_c(request):
url(r'^$', prac_c),
url(r'^q=\d',fetch_c),
这是views.py
def prac_c(request):
return render_to_response('subject/c.html', {"problem_list":problem_list})
def fetch_c(request):
qno = request.GET.get('q')
if qno:
return render_to_response('subject/que.html', {'qno':qno}, context_instance=RequestContext(request))
但我不会被引导到que.html。URL.py有问题吗
URLconf搜索的对象是什么
URLconf以普通Python字符串的形式搜索请求的URL。这不包括GET或POST参数,也不包括域名