0
嗨,我做了一些ModelForm。现在当我进入我得到这个错误。表单操作不起作用| Django
RuntimeError
Exception Value:
You called this URL via POST, but the URL doesn't end in a slash and you have APPEND_SLASH set. Django can't redirect to the slash URL while maintaining POST data. Change your form to point to 127.0.0.1:8000/comp/new/ (note the trailing slash), or set APPEND_SLASH=False in your Django settings.
这是什么造成的?可能表单动作完全匹配URL comp/new的形式,这与我的视图匹配以呈现和处理数据。但是,出事了....
我的网址
url(r'^comp/new/$', 'company.views.add_company', name='add_company'),
我的表单操作
<form id="category_form" method="post" action="/comp/new/">
它需要一个/最后。你的表单行为显然没有,就像你在你的文章中所说的那样。/comp/new/- 错误消息告诉你到底发生了什么错误。 – Ben 2014-12-07 23:20:47
我试图把这样的斜线/ comp/new /放在它上面,但不工作。请求网址:\t http://127.0.0.1:8000/comp/new其不变。 – oranj33 2014-12-07 23:25:24
向我们显示您的表单代码 - HTML代码。 – Ben 2014-12-07 23:31:06