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
































  • 相关阅读:
    看《长安十二时辰》可以了解哪些算法知识
    面试官,我会写二分查找法!对,没有 bug 的那种!
    毕业十年后,我忍不住出了一份程序员的高考试卷
    扫雷与算法:如何随机化的布雷(一)
    降维打击!为什么我认为数据结构与算法对前端开发很重要
    盖尔-沙普利算法告诉你,你的对象在哪里?
    这道算法题太太太太太简单啦
    有点难度,几道和「滑动窗口」有关的算法面试题
    几道和「黑洞照片」那种海量数据有关的算法问题
    LeetCode 上最难的链表算法题,没有之一!
  • 原文地址:https://www.cnblogs.com/xuchunlin/p/6676292.html
Copyright © 2011-2022 走看看