我正在瀏覽django教程,我想知道在views.py中有兩個具有相同名稱的函數時會發生什麼?可以通過django查看功能互相覆蓋嗎?
例如:
def results(request, poll_id):
p = get_object_or_404(Poll, pk=poll_id)
return render_to_response('polls/results.html', {'poll': p})
def results(request, poll_id):
return HttpResponse("You're looking at the results of poll %s." % poll_id)
當我跑的代碼,底部功能是被稱爲一個。這個怎麼用?