Добрый день. Я пытаюсь переопределить обычную аутентификацию basi c. Всякий раз, когда я посещаю user/login/
url, я получаю сообщения об ошибках.
urls.py
app_name = 'user'
urlpatterns = [
path('user/login/', LoginView.as_view(
template_name='registration/login.html',
authentication_form=LoginForm), name='login'),
path('user/', include(urls)),
]
forms.py
class LoginForm(AuthenticationForm):
def __init__(self, *args, **kwargs):
super(LoginForm, self).__init__(args, kwargs)
username = forms.EmailField(widget=forms.TextInput(
attrs={'class': 'form-control', 'placeholder': 'Email address',
'type': 'email', 'id': 'inputEmail'}
), label='')
password = forms.CharField(widget=forms.PasswordInput(
attrs={'class': 'form-control', 'placeholder': 'Password',
'type': 'password', 'id': 'inputPassword'}
), label='')
логин. html
<div class="container text-center">
<h1 class="h3 mb-3 font-weight-normal">Sign-in</h1>
<form action="." method="post" class="form-signin">
{{ form.as_p }}
{% csrf_token %}
<input type="hidden" value="{{ next }}">
<input type="submit" value="Login" class="btn btn-primary">
</form>
</div>