我收到以下错误:view_page() takes exactly 2 arguments (1 given)
view.py 的代码是:
from wiki.models import Page
from django.shortcuts import render_to_response
def view_page(request, page_name):
try:
page = Page.objects.get(pk=page_name)
except PageDoesNotExist:
return render_to_response("create.html", {"page_name":page_name})
url.py 中给出的 url 是:
url(r'^wiki/$', 'wiki.views.view_page'),
但是,当我给出下面给出的 url 并删除上面的那个时,我得到了找不到页面的错误。
url(r'^wiki/(?P<page_name>[^/]+)/$','wiki.views.view_page'),