Commit 05aadb7b authored by impfundev's avatar impfundev

feat: migrate login and sign up form using django ModelForm

parent 2bf5ac00
from django import forms
from librarians.models import Librarians
class LoginForm(forms.Form):
# template_name = "form_snippet.html"
email = forms.EmailField(
widget=forms.TextInput(
class LoginForm(forms.ModelForm):
class Meta:
model = Librarians
fields = ["email", "password"]
widgets = {
"email": forms.EmailInput(
attrs={
"placeholder": "Email",
"class": "form-control",
}
)
)
password = forms.CharField(
widget=forms.PasswordInput(
),
"password": forms.PasswordInput(
attrs={
"placeholder": "Password",
"class": "form-control",
}
)
)
),
}
class SignUpForm(forms.Form):
name = forms.CharField(
max_length=50,
widget=forms.TextInput(
class SignUpForm(forms.ModelForm):
class Meta:
model = Librarians
fields = ["name", "email", "password"]
widgets = {
"name": forms.TextInput(
attrs={
"placeholder": "Name",
"class": "form-control",
}
),
)
email = forms.EmailField(
widget=forms.TextInput(
"email": forms.EmailInput(
attrs={
"placeholder": "Email",
"class": "form-control",
}
)
)
password = forms.CharField(
max_length=255,
widget=forms.TextInput(
),
"password": forms.PasswordInput(
attrs={
"placeholder": "Password",
"class": "form-control",
}
),
)
}
class ForgotPassword(forms.Form):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment