Skip to content

Commit

Permalink
feat: Override signup form to include name fields
Browse files Browse the repository at this point in the history
  • Loading branch information
annehaley committed Sep 25, 2024
1 parent 1754ac3 commit de74292
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
15 changes: 15 additions & 0 deletions uvdat/core/rest/accounts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from allauth.account.forms import SignupForm
from django import forms


class AccountSignupForm(SignupForm):
first_name = forms.CharField(
label=('First Name'),
min_length=1,
widget=forms.TextInput(attrs={'placeholder': ('First name')}),
)
last_name = forms.CharField(
label=('Last Name'),
min_length=1,
widget=forms.TextInput(attrs={'placeholder': ('Last name')}),
)
3 changes: 3 additions & 0 deletions uvdat/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ class UvdatMixin(ConfigMixin):

BASE_DIR = Path(__file__).resolve(strict=True).parent.parent

# Override default signup sheet to ask new users for first and last name
ACCOUNT_FORMS = {'signup': 'uvdat.core.rest.accounts.AccountSignupForm'}

@staticmethod
def mutate_configuration(configuration: ComposedConfiguration) -> None:
# Install local apps first, to ensure any overridden resources are found first
Expand Down

0 comments on commit de74292

Please sign in to comment.