zoukankan      html  css  js  c++  java
  • 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=" 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=" 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是不相同的,一定要注意两着区别的
































  • 相关阅读:
    SQL如何获取上一条..下一条..首尾记录
    PHP判断浏览器类型的代码
    html命名规范
    使用JavaScript JS 获取label for 标签的值和for值
    PNG透明兼容IE6的几种方法
    冉茂锋同学去上课了
    十一戒,自勉
    语录
    CreateThread最后还是调用的ntdll.dll里面的ZwCreateThread
    InitializeObjectAttributes
  • 原文地址:https://www.cnblogs.com/xuchunlin/p/6676292.html
Copyright © 2011-2022 走看看