in the editing section, the idea is to jump to the page in the editor to give him a URL containing a unique ID, and then through the URL of the ID to query the data, the data content displayed on the edit page. 1. Edit button
<button onclick= "window.location= '/edit/{{project.id}}'" ><a href= "/edit/" > Edit </a></ Button>
2.URL configuration, the part enclosed in () is the parameter, if there are multiple parameters, use multiple ()
Urlpatterns = Patterns ("',
......
(' ^edit/(\w+)', Views.edit),
) + static (settings. Static_url, Document_root=settings. Static_root)
the editing method in 3.view.py, the first parameter of each method is the default request, the second argument, the third argument, and so on, can be the parameter obtained from the URL
def edit (Request,param):
Post = project.objects (Id=param) [0]
......
Return Render_to_response ("edit.html", Locals (), Context_instance=requestcontext (Request))
Django passes parameters via URL (Edit action page)