Skip to content

Commit

Permalink
Merge branch 'fix/rename_melos_unicore' of github.com:UTNkar/moore in…
Browse files Browse the repository at this point in the history
…to fix/rename_melos_unicore
  • Loading branch information
robindymer committed Dec 6, 2023
2 parents 31d84a4 + dd08b13 commit a650a07
Showing 1 changed file with 28 additions and 10 deletions.
38 changes: 28 additions & 10 deletions src/members/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@


class MemberForm(forms.ModelForm):
section = forms.ModelChoiceField(
required=False,
queryset=Section.objects.order_by('abbreviation'),
label=_('Section'),
)
person_number = PersonNumberField(
label=_('Person number'),
help_text=_('Person number using the YYYYMMDD-XXXX format.'),
Expand Down Expand Up @@ -81,6 +86,12 @@ def save(self, commit=True):


class RegistrationForm(MemberForm, auth.UserCreationForm):
section = forms.ModelChoiceField(
required=False,
queryset=Section.objects.order_by('abbreviation'),
label=_('Section'),
)

class Meta:
model = Member
fields = ['username', 'email', 'phone_number', 'section']
Expand Down Expand Up @@ -219,6 +230,12 @@ def password_enabled(self):
widget=forms.PasswordInput,
help_text=_("Enter the same password as above, for verification."))

section = forms.ModelChoiceField(
required=False,
queryset=Section.objects.order_by('abbreviation'),
label=_('Section'),
)

is_superuser = forms.BooleanField(
label=_("Administrator"), required=False,
help_text=_('Administrators have full access to manage any object '
Expand Down Expand Up @@ -307,6 +324,11 @@ def save(self, commit=True):

class UserEditForm(UserForm):
password_required = False
section = forms.ModelChoiceField(
required=False,
queryset=Section.objects.order_by('abbreviation'),
label=_('Section'),
)

def __init__(self, *args, **kwargs):
kwargs.pop('editing_self', False)
Expand All @@ -332,10 +354,9 @@ class CustomUserEditForm(UserEditForm):
help_text=_('Person number using the YYYYMMDD-XXXX format.'),
required=False
)
phone_number = forms.CharField(
required=True,
label=_('Phone number'),
)

phone_number = PhoneNumberField()

email = forms.EmailField(
required=True,
label=_('Email'),
Expand All @@ -351,7 +372,7 @@ class CustomUserEditForm(UserEditForm):
)
section = forms.ModelChoiceField(
required=False,
queryset=Section.objects,
queryset=Section.objects.order_by('abbreviation'),
label=_('Section'),
)
status = forms.ChoiceField(
Expand Down Expand Up @@ -400,10 +421,7 @@ class CustomUserCreationForm(UserCreationForm):
required=True,
label=_('Email'),
)
phone_number = forms.CharField(
required=True,
label=_('Phone number'),
)
phone_number = PhoneNumberField()
registration_year = forms.CharField(
required=False,
label=_('Registration year'),
Expand All @@ -415,7 +433,7 @@ class CustomUserCreationForm(UserCreationForm):
)
section = forms.ModelChoiceField(
required=False,
queryset=Section.objects,
queryset=Section.objects.order_by('abbreviation'),
label=_("Section"),
)

Expand Down

0 comments on commit a650a07

Please sign in to comment.