def test(request, arg1, arg2):
c = [[calendar.month_name[(i.date).month],i.count] for i in
Model_name.objects.filter(worker = arg1, process = arg2)]
c.insert(0,['Month', 'Counts']) # It's for Chart Purpose
return render_to_response('test3.html', {'array': json.dumps(array3)})
这是我的观点和网址
url(r'^test/(?P<ass_name>/<process_name>\w+)/$', 'model_name.views.test', name='test')
引发了我404错误。有什么建议吗?
答案 0 :(得分:1)
这里有几个问题:
您无法合并多个网址参数。
网址参数名称必须与视图的参数名称相同。
因此,请将您的网址更改为:
url(r'^test/(?P<ass_name>\w+)/(?P<process_name>\w+)/$', 'model_name.views.test', name='test')
你的观点对此起作用:
def test(request, ass_name, process_name):