Django删除登录警报消息AllAuth

时间:2018-12-28 04:39:38

标签: django allauth

我正在将AllAuth与Django一起使用来制作logjn表单。问题是我试图删除登录表单中从form | crispy字段中产生的错误消息,以便仅使用表单外部底部的代码来显示该错误消息。这可能吗?

Login.HTML

 <form class="login" method="POST" action="{% url 'account_login' %}" style="list-style-type: none;">
 {% csrf_token %}
 {{ form|crispy }}

 {% if redirect_field_value %}
 <input  type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
 {% endif %}
 <button class="primaryAction btn btn-primary shadow  mt-2" style="width: 100%;" type="submit">{% trans "Sign In" %}</button>
 </form>




// Added Error Message to Custom location 

      {% if form.errors %}
      {% for field in form %}
      {% for error in field.errors %}
      <div class="container-fluid messages moveInTop">
          <div class="alert alert-error alert-danger card">
            {{ error|escape }}
          </div>
        </div>

      {% endfor %}
      {% endfor %}
      {% for error in form.non_field_errors %}
      <div class="container-fluid messages moveInTop" style="width: 28rem; z-index: 100; position: fixed; bottom: 10%; opacity: .95; left: 60.2%;">
        <div class="alert alert-error alert-danger messages card">
        {{ error|escape }}
        </div>
      </div>

      {% endfor %}
      {% endif %}

0 个答案:

没有答案
相关问题