I am getting the following error: view_page() takes exactly 2 arguments (1 given)
The code of view.py is:
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})
the url given in url.py is :
url(r'^wiki/$', 'wiki.views.view_page'),
But when I am giving the url as given below and delete the above one then i am getting the error of page not found.
url(r'^wiki/(?P<page_name>[^/]+)/$','wiki.views.view_page'),
This is because the second parameter for the view_page() is passed in the url
example
if u use this