urls for django modelforms
I created a form by following django tutorial on modelfomrs. This is the url I used:
(r'^frm/manage开发者_高级运维/$', 'frm.views.manage'),
But when I submit the data, I get 404 page with this error The current URL, manage/, didn't match any of these
.
My template:
<html>
<body>
<form method="post" action="/manage/">
{{ formset }}
<p><input type="submit" value="Write data" /></p>
</form>
</body>
</html>
This is basic HTML.
Your form is posting to the url /manage/
, not /frm/manage/
<form method="post" action="/manage/">
Change the line to be action=""
, action="."
(relative urls pointing to itself), explicitly point to your view action="/frm/manage/"
, or remove the action
line altogether to post to the same URL as the view serving the form.
精彩评论