2025-11-27 11:53:46 +05:30
|
|
|
from django import forms
|
|
|
|
|
from django.contrib.auth.forms import UserCreationForm
|
2025-11-28 03:11:38 +05:30
|
|
|
from django.contrib.auth.forms import AuthenticationForm
|
2025-11-27 11:53:46 +05:30
|
|
|
from .models import User
|
2025-11-28 16:03:23 +05:30
|
|
|
from django import forms
|
2025-11-27 11:53:46 +05:30
|
|
|
|
2025-11-28 03:11:38 +05:30
|
|
|
|
2025-11-28 16:03:23 +05:30
|
|
|
class UserForm(AuthenticationForm):
|
2025-11-28 03:11:38 +05:30
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
|
super().__init__(*args, **kwargs)
|
2025-11-28 16:03:23 +05:30
|
|
|
for field in self.fields.values():
|
|
|
|
|
field.widget.attrs.update({"class": "form-control"})
|
2025-11-28 03:11:38 +05:30
|
|
|
|
2025-11-27 11:53:46 +05:30
|
|
|
|
|
|
|
|
class LoginForm(AuthenticationForm):
|
2025-11-28 16:03:23 +05:30
|
|
|
username = forms.CharField(
|
|
|
|
|
widget=forms.TextInput(attrs={
|
|
|
|
|
"class": "form-control",
|
|
|
|
|
"placeholder": "Enter username"
|
|
|
|
|
})
|
|
|
|
|
)
|
|
|
|
|
password = forms.CharField(
|
|
|
|
|
widget=forms.PasswordInput(attrs={
|
|
|
|
|
"class": "form-control",
|
|
|
|
|
"placeholder": "Enter password"
|
|
|
|
|
})
|
|
|
|
|
)
|