• 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是不相同的,一定要注意两着区别的
































  • 相关阅读:
    二:数组去重
    一:JS 数组对象根据相同key合并成新的数组对象(将一维数组转为多维数组)
    滑动scroll没有效果
    品字布局占满全屏
    js计算器
    html样式初始化
    js计算器
    js邮箱验证
    js菱形
    js实现金字塔图形
  • 原文地址:https://www.cnblogs.com/xuchunlin/p/6676292.html
Copyright © 2020-2023  润新知