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

30 lines
922 B
Python
Raw Normal View History

2023-12-19 13:49:34 +01:00
from crispy_forms import helper, layout
2023-12-18 23:05:49 +01:00
from django.contrib.auth.forms import AuthenticationForm, UserCreationForm
2023-12-19 13:49:34 +01:00
from .models import User
2023-12-18 23:05:49 +01:00
# from .models import User
class LoginForm(AuthenticationForm):
2023-12-19 13:49:34 +01:00
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")
2023-12-18 23:05:49 +01:00
2023-12-19 13:49:34 +01:00
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'))