I am trying something that I believe must be so simple but nothing has worked.
I have added the auth by adding into my urls.py:
path('accounts/', include('django.contrib.auth.urls'), {'template_name': 'login.html', 'authentication_form': forms.LoginForm}),
This is my urls.py:
from django.contrib import admin
from django.urls import path, include
from reports import views, forms
urlpatterns = [
path('', views.IndexView.as_view(), name='home'),
path('admin/', admin.site.urls),
path('accounts/', include('django.contrib.auth.urls'), {'template_name': 'login.html', 'authentication_form': forms.LoginForm}),
]
My project has an app called reports, in here i have my templates folder and i have added my registration folder with login.html and all the relevant files.
I have also created in my project (reports) a file forms.py and added
from django.contrib.auth.forms import AuthenticationForm
# from django import forms
class LoginForm(AuthenticationForm):
username = forms.CharField(widget=forms.TextInput(
attrs={
'class':'form-control',
'placeholder':'Username'
}
))
password = forms.CharField(widget=forms.PasswordInput(
attrs={
'class':'form-control',
'placeholder':'Password'
}
))
My form is displayed but the class and placeholder is not been added
any suggestion of what i need to add or change?
my current login.html
<form class="form-signin" method="post">
{% csrf_token %}
{{ form.as_p }}
<button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
<p class="mt-5 mb-3 text-muted">
<a href="{% url 'password_reset' %}">Lost password?</a>
</p>
</form>