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: []的更多相关文章

  1. 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: [] ...

  2. 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: [' ...

  3. <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 ...

  4. django错误-NoReverseMatch at /admin/

    错误提示: NoReverseMatch at /admin/ Reverse for 'logout' with arguments '()' and keyword arguments '{}' ...

  5. Django url()函数详解

    url()函数看起来的格式象: url(r^/account/$', views.index, name=index) ,它可以接收四个参数,分别是两个必选参数: regex . view 和两个可选 ...

  6. url的配置

    from django.conf.urls import patterns, url urlpatterns = patterns('common.views', url(r'^$', 'index' ...

  7. [python][django学习篇][12]继续设计博客首页,点击博客标题能显示文章的详情

    回顾一下开发流程:配置url, 编写视图函数,编写对应模板 配置URL 首页视图匹配的 URL 去掉域名后,是一个空的字符串.每篇文章的详情有着不同的 URL,因此可以设计文章详情页面URl:< ...

  8. 关于Django模板引擎的研究

    原创博文,转载请注明出处. 以前曾遇到过错误Reverse for ‘*’ with arguments '()' and keyword arguments' not found.1其原因是没有给视 ...

  9. Django模板引擎的研究

    Django模板引擎的研究 原创博文,转载请注明出处. 以前曾遇到过错误Reverse for ‘*’ with arguments '()' and keyword arguments' not f ...

随机推荐

  1. 应用 TransactionScope 报:此操作对该状态的事务无效 的错误

    如果在事务过程跨了数据库服务器(即使在同一台服务器上,两个不同的数据库实例也算跨数据库服务器),而使用 TransactionScope 却报:此操作对该状态的事务无效 的错误 是因为没有启用每台服务 ...

  2. Setup JIRA Service Desk 3.9.2 on Oracle Linux 6.8

    OS Oracle Linux 6.8 V138414-01.iso Database mysql5.6.30 MySQL-5.6.30-1.el6.x86_64.rpm-bundle.tar JIR ...

  3. Android内存优化14 内存泄漏常见情况5 特殊对象造成的内存泄漏 WebView内存泄漏

    WebView造成内存泄露 关于WebView的内存泄露,因为WebView在加载网页后会长期占用内存而不能被释放,因此我们在Activity销毁后要调用它的destory()方法来销毁它以释放内存. ...

  4. (原)未能启用约束。一行或多行中包含违反非空、唯一或外键约束的值与DATEADD

    SQLServer2014,查询分析器中 这样的脚本是没有问题的:AND TPO.CREATEON <= DATEADD(DAY, 1, '2017/3/3 0:00:00') 但.NET  D ...

  5. VMware Workstation 重启服务脚本 解决连不上ssh问题

    解决虚拟机,每次启动连不上ssh问题,需要关闭虚拟机,再执行脚本.执行完后,再启动虚拟机就可以连上ssh啦! 脚本名称:vmware_server_restart.bat (请以管理员身份运行,否则可 ...

  6. material.setTexture("sampler",tex) assetbundle 下失效

    做镜面反射本来写很顺 在手机上测的时候 发现settexture这里绑不上 查好久 是assetbundle的缘故 因为动态加载的 obj用了mat01 我在反射脚本里动态修改mat01而不是拿 re ...

  7. 解决:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile

    在项目构建的时候遇到了这样的问题:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile(d ...

  8. [Angular] Angular i18n Pluralization Support

    // Component: this.coursesTotal = this.course,length <div i18n>{coursesTotal, plural, =0 {No c ...

  9. vue - webpack.dev.conf.js for HtmlWebpackPlugin

    描述: 这是一个webpack插件,可以简化HTML文件的创建,为您的webpack捆绑服务提供服务. 这对于webpack包含文件名中包含哈希值的bundle 来说尤其有用,它会更改每个编译. 您可 ...

  10. 使用PHP和GZip压缩网站JS/CSS文件加速网站访问速度

    使用PHP和GZip压缩网站JS/CSS文件加速网站访问速度 一些泛WEB 2.0网站为了追求用户体验,可能会大量使用CSS和JS文件.这就导致在服务器带宽一定的情况下,多用户并发访问速度变慢.如何加 ...