NoReverseMatch at /salesman/zhuce/ Reverse for '/zhuce/' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
NoReverseMatch at /salesman/zhuce/
Reverse for '/zhuce/' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
对于上面的错误,有可能是django模板的错误,下面我粘贴出来错误的配置代码
一. 错误代码,错误部门用红色字体标出
错误配置
<div id ="user">
<form action="{% url '/zhuce/' %}" method="post" enctype="application/x-www-form-urlencoded">
{% csrf_token %}
{{ Register_from.user_name.label }}{{ Register_from.user_name }}<br><br>
{{ Register_from.password.label }}{{ Register_from.password }}<br><br>
{{ Register_from.phone_no.label }}{{ Register_from.phone_no }}<br>{{ raise_error }}<br> {{ Register_from.email.label }}{{ Register_from.email }}<br><br>
{{ Register_from.department.label }}{{ Register_from.department }}<br><br><br><br> <input type="submit" class="button small border-radius-bottom coral-bg" style="width: 50px ;height:30px;" value="注册" onclick="loading();" >
<br>{{ register_success }}{{ register_fail }}
</form> </div>
正确配置
一 用表单生成模板的正确action配置
<body>
<div id ="user">
<form action="{% url 'zhuce' %}" method="post" enctype="application/x-www-form-urlencoded">
{% csrf_token %}
{{ Register_from.user_name.label }}{{ Register_from.user_name }}<br><br>
{{ Register_from.password.label }}{{ Register_from.password }}<br><br>
{{ Register_from.phone_no.label }}{{ Register_from.phone_no }}<br>{{ raise_error }}<br> {{ Register_from.email.label }}{{ Register_from.email }}<br><br>
{{ Register_from.department.label }}{{ Register_from.department }}<br><br><br><br> <input type="submit" class="button small border-radius-bottom coral-bg" style="width: 50px ;height:30px;" value="注册" onclick="loading();" >
<br>{{ register_success }}{{ register_fail }}
</form> </div>
二.用HTML写的前段 action 代码。
{#<body>#}
{#<div id="user">#}
{# <form action="/salesman/register/" method="post" enctype="application/x-www-form-urlencoded">#}
{# <h2> 添加业务员 </h2>#}
{# 用户名: <input type="text" name="user_name"> {{ error_message }}{{ user_name_error }} <br/>#}
{# 手机号: <input type="text" name="phone_no"> {{ phone_error_message }} {{ phone_error }} <br/>#}
{# 密码 : <input type="text" name="password"> {{ password_error_message }} <br/>#}
{##}
{# <input id = 'submit' type="submit" value="注册">#}
{# {{ create_success }}#}
{# </form>#}
{#</div>#}
{#</body>#}
{#</html>#}
注意使用form生成前端页面和用HTML生成模板的action是不相同的,一定要注意两着区别的
NoReverseMatch at /salesman/zhuce/ Reverse for '/zhuce/' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []的更多相关文章
- Django Reverse for 'artic_post' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
Reverse for 'home' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: [] ...
- django 报错Reverse for 'detail' with keyword arguments '{'pk': '2'}' not found. 1 pattern(s) tried: ['$post/(?P<pk>[0-9]+)/$']
Django报错:Reverse for 'detail' with keyword arguments '{'pk': '2'}' not found. 1 pattern(s) tried: [' ...
- <class 'Salesman.admin.UsrUserAdmin'>: (admin.E012) There are duplicate field(s) in 'fieldsets[0][1]'.
ieldsets = ( ['Main', { 'fields': ('user_name', 'real_name', 'concat_name','phone_no','charge_person ...
- django错误-NoReverseMatch at /admin/
错误提示: NoReverseMatch at /admin/ Reverse for 'logout' with arguments '()' and keyword arguments '{}' ...
- Django url()函数详解
url()函数看起来的格式象: url(r^/account/$', views.index, name=index) ,它可以接收四个参数,分别是两个必选参数: regex . view 和两个可选 ...
- url的配置
from django.conf.urls import patterns, url urlpatterns = patterns('common.views', url(r'^$', 'index' ...
- [python][django学习篇][12]继续设计博客首页,点击博客标题能显示文章的详情
回顾一下开发流程:配置url, 编写视图函数,编写对应模板 配置URL 首页视图匹配的 URL 去掉域名后,是一个空的字符串.每篇文章的详情有着不同的 URL,因此可以设计文章详情页面URl:< ...
- 关于Django模板引擎的研究
原创博文,转载请注明出处. 以前曾遇到过错误Reverse for ‘*’ with arguments '()' and keyword arguments' not found.1其原因是没有给视 ...
- Django模板引擎的研究
Django模板引擎的研究 原创博文,转载请注明出处. 以前曾遇到过错误Reverse for ‘*’ with arguments '()' and keyword arguments' not f ...
随机推荐
- Scala 匿名函数
Scala 中定义匿名函数的语法很简单,箭头左边是参数列表,右边是函数体. 使用匿名函数后,我们的代码变得更简洁了. 下面的表达式就定义了一个接受一个Int类型输入参数的匿名函数: var inc = ...
- Linux限制某些用户或IP登录SSH、允许特定IP登录SSH
说明:一般要实现这种功能时,先安装VPN,然后客户端登录VPN,然后通过内网IP登录SSH. 搭建OpenVPN: 参考:http://www.cnblogs.com/EasonJim/p/83338 ...
- C# mvc Request 请求过长报404错误的解决思路分析
案例 我们需要根据index 页面选取值 然后 在弹出页面展示已经选取的值 但其实Request 超出请求长度,后来经过模式解决了. 分享如下 1.设定 web.config 里面的 在web.con ...
- virtualbox4.2.18 ubuntu12.04 The system is running in low-graphics mode
参考1:http://askubuntu.com/questions/225090/the-system-is-running-in-low-graphics-mode-error-in-virtua ...
- Oracle SQL执行缓慢的原因以及解决方案
以下的文章抓哟是对Oracle SQL执行缓慢的原因的分析,如果Oracle数据库中的某张表的相关数据已是2亿多时,同时此表也创建了相关的4个独立的相关索引.由于业务方面的需要,每天需分两次向此表中 ...
- alert和console的区别
前端开发调试中用的最多的两个命令就是console和alert了吧,做了两年前端了,发现好多人连这两个命令的区别都还不清楚,今天正好没什么事情做,于是按照自己的理解随便说说. alert: 1.会 ...
- [java] 模拟QPS
在WEB服务器端,每日的访问量巨大.在非生产环境需要对服务器进行压力测试,一般使用后台线程和Sleep方式来模拟线上的压力.这里使用ScheduledExecutorService实现一种简单的QPS ...
- [转]SSIS中OLE DB Source中如何执行Store Procedure 以得到源数据
本文转自:http://www.cnblogs.com/michaelxu/archive/2009/10/16/1584284.html 有很多人喜欢在OLE DB Source中执行Store P ...
- deferred rendering with msaa
https://docs.nvidia.com/gameworks/content/gameworkslibrary/graphicssamples/d3d_samples/antialiasedde ...
- Chrome DevTools快捷键