crispy-forms will give you bootstrap design. If you want to apply your own css then install "django-widget-tweaks".
On Mon, Feb 15, 2021, 1:10 AM Omkar Parab <[email protected]> wrote: > Install django-widget-tweaks package. > > On Mon, Feb 8, 2021, 2:11 AM Tal Bar-Or <[email protected]> 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 >> >> >> 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 [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/f757c3c4-d8bf-4cc0-89a2-48638130b59an%40googlegroups.com >> <https://groups.google.com/d/msgid/django-users/f757c3c4-d8bf-4cc0-89a2-48638130b59an%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJY8mfwdUK8eh%2BZynZ2fX4oH6-34g6PEPa9TqSGCpbvhmGcD0A%40mail.gmail.com.

