Ошибки не отображаются в форме шаблона регистрации Django
Привет мне нужна помощь с моим кодом, ошибки не отображаются в моей HTML форме и я не знаю как отладить ее или как понять почему div не отображается, я пытался изменить его CSS я пытался изменить имя класса я пробовал все я просто не могу заставить его отображаться когда я ставлю плохие входы.
views.py
from django.shortcuts import render, redirect
from .forms import SignUpForm
from django.contrib.auth import login
def frontpage(request):
return render(request,'core/frontpage.html')
def signup(request):
if request.method == 'POST':
form = SignUpForm(request.POST)
if form.is_valid():
user = form.save()
login(request, user)
return redirect('frontpage')
else:
form = SignUpForm()
return render(request, 'core/signup.html', {'form': form})
signup.html
{% extends 'core/base.html' %}
{% block title %} Sign Up | {% endblock %}
{% block content %}
<div class="main">
<h1>Sign Up</h1>
</div>
<div class="form-container">
<form method="post" action="." class="sign-up-form">
{% csrf_token %}
<p>Fill Form :</p>
<div class="form-items">
<label for="username">Username</label>
<input type="text" class="label" id="username" name="username" placeholder="Username" >
<label for="password">Password</label>
<input type="password" class="label" id="password" name="password1" placeholder="Password">
<label for="confirm-password">Confirm Password</label>
<input type="password" class="label" id="confirm-password" name="password2" placeholder="Confirm Password">
{% if form.error %}
{% for field in form %}
{% for error in field.errors %}
<div class="error-msg">
<p>{{ error|escape }}</p>
</div>
{% endfor %}
{% endfor %}
{% endif %}
<div class="form-control-buttons">
<button type="submit" class="button">Sign Up</button>
<button type="button" onclick="form.reset()" class="restart-form">Reset Form</button>
</div>
</form>
</div>
{% endblock %}
print(form.errors) показывает :
<ul class="errorlist">
<li>password2
<ul class="errorlist">
<li>The password is too similar to the username.</li>
<li>This password is too short. It must contain at least 8 characters.</li>
<li>This password is too common.</li>
</ul>
</li>
</ul>