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. Educational Codeforces Round 8 E. Zbazi in Zeydabad 树状数组

    E. Zbazi in Zeydabad 题目连接: http://www.codeforces.com/contest/628/problem/D Description A tourist wan ...

  2. [标准性文档]WEB应用安全验证标准

    这是根据OWASP ASVS翻译过来的,可作为WEB应用开发的验收标准(未包含具体细节),值得注意的是,验收标准并非越严格越好,应根据企业自身的业务需求判定. WEB应用安全验证标准 安全验证等级的定 ...

  3. delphi 杀死进程

    http://blog.sina.com.cn/s/blog_554b1f1b0100aygo.html unit Tlhelp323; interface uses  Windows,SysUtil ...

  4. andriod inputType

    <EditText Android:layout_width="fill_parent" android:layout_height="wrap_content&q ...

  5. java使用HttpClient 发送get、pot请求

    package eidolon.messageback.PostUtil; import java.io.BufferedReader; import java.io.IOException; imp ...

  6. mac下如何全量删除短信内容

    退出messages应用 执行命令:rm -r ~/Library/Messages/chat.* 重启messages 如果遇到下面问题:重启mac

  7. 使用nsswitch控制linux dns解析顺序

    参考:1.DNS原理入门参考:http://www.ruanyifeng.com/blog/2016/06/dns.html 2.http://cn.linux.vbird.org/linux_ser ...

  8. android4.1 JELLY_BEAN:All WebView methods must be called on the same thread[问题已解决]

    11-06 18:29:15.582: W/WebView(27807): java.lang.Throwable: A WebView method was called on thread 'Ja ...

  9. [转]SSIS Execute SQL Task : Mapping Parameters And Result Sets

    本文转自:http://www.programmersedge.com/post/2013/03/05/ssis-execute-sql-task-mapping-parameters-and-res ...

  10. jQuery匹配各种条件的选择器用法

    :hidden匹配所有的不可见元素,input 元素的 type 属性为 "hidden" 的话也会被匹配到Matches all elements that are hidden ...