This repository has been archived on 2025-03-03. You can view files and clone it, but cannot push or open issues or pull requests.
facturio/account/forms.py
2023-12-19 12:49:34 +00:00

29 lines
922 B
Python

from crispy_forms import helper, layout
from django.contrib.auth.forms import AuthenticationForm, UserCreationForm
from .models import User
# from .models import User
class LoginForm(AuthenticationForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = helper.FormHelper()
self.helper.form_action = "login"
self.helper.form_method = "post"
self.helper.add_input(layout.Submit('submit', 'Login'))
class RegisterForm(UserCreationForm):
class Meta:
model = User
fields = UserCreationForm.Meta.fields + ("first_name", "last_name", "email")
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = helper.FormHelper()
self.helper.form_action = "register"
self.helper.form_method = "post"
self.helper.add_input(layout.Submit('submit', 'Register'))