Hello ,

I writing project which the user login with my own customized HTML page 
(boosstrap)

i can manually add the form.username and form.password , but seems they 
don't get the attribute from my forms.py , dode is added below , please 
advise

Thanks


urls.py
from django.urls import path 
from django.contrib.auth import views as auth_views from .views import * 
urlpatterns = [ 
    path('login/', auth_views.LoginView.as_view(), name = 'login'), 
 path('signup/', SignUpView.as_view(), name='signup'), ] 


views.py
from django.contrib.auth.forms import UserCreationForm 
from django.contrib.auth.views import LoginView 
from django.urls import reverse_lazy from django.views import generic 
from .forms import * class UsersLoginView(LoginView): 
    template_name = 'login.html'     success_url = 'blog-home' 
    success_message = 'Welcome to your profile' 
    form_class = UserLoginForm 

forms.py
from django import forms from django.forms import ModelForm 
from .models import User class UserLoginForm(forms.ModelForm): 
    username = forms.CharField(widget=forms.TextInput(attrs={'class': 
'form-control', 'type':'email', 'name':'Username', 'placeholder':'Username'})) 
    password = forms.CharField(widget=forms.PasswordInput(attrs={'class': 
'form-control', 'type': 'password', 'name': 'password', 
'placeholder':'Password'})) 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f757c3c4-d8bf-4cc0-89a2-48638130b59an%40googlegroups.com.

Reply via email to