开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜