按照官方文档https://docs.djangoproject.co...,但是自己做了些修改后,登录表单提交一直失败,求教是因为什么问题导致的。
代码如下:
urls.py
urlpatterns = [
path('accounts/login/', auth_views.LoginView.as_view(template_name='login.html'), name='login'),
]
login.html
{% block main %}
{% if form.errors %}
Your username and password didn't match. Please try again.
{{ form.errors }}
{% endif %}
{% if next %}
{% if user.is_authenticated %}
Your account doesn't have access to this page. To proceed,
please login with an account that has access.
{% else %}
Please login to see this page.
{% endif %}
{% endif %}
{# Assumes you setup the password_reset view in your URLconf #}
{% endblock %}