You should consider using crispy forms plugin. They easily style your forms.
On Sun, 14 Feb 2021, 7:36 pm Sherif Adigun, <adigunsherif@gmail.com> wrote:
Try changing UserLoginForm(forms.ModelForm) to UserLoginForm(forms.Form)--On Sunday, February 7, 2021 at 9:41:35 PM UTC+1 tba...@gmail.com wrote:
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
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'), ]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 = UserLoginFormfrom 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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6ac6a8c7-bc9a-46f3-b8cb-e138a76ec298n%40googlegroups.com.
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPtJsRhQX4E6C-kf5YGDpEwd1zKa%3DUzGwqo9sGf1%2BG8kOFD1fQ%40mail.gmail.com.
No comments:
Post a Comment