forms.py 1.13 KB
Newer Older
1
# core django imports
2
from django import forms
3
# third party imports
4
from crispy_forms.helper import FormHelper
Daniel W Bond's avatar
Daniel W Bond committed
5
6
from crispy_forms.layout import Submit, Layout
from crispy_forms.bootstrap import PrependedText, AppendedText
Daniel W Bond's avatar
Daniel W Bond committed
7
from multiselectfield import MultiSelectFormField
8
# imports from your apps
9
from .models import Student, Room, Major
10

Daniel W Bond's avatar
Daniel W Bond committed
11

12
class StudentUpdateForm(forms.Form):
13

14
15
16
17
18
19
20
    first_name = forms.CharField(label='First Name')
    last_name = forms.CharField(label='Last Name')
    gender = MultiSelectFormField(choices=Student.GENDER_CHOICES,
                                  label='Gender Identity (please choose all that apply)')
    room = forms.ModelChoiceField(queryset=Room.objects.all())
    privacy = forms.ChoiceField(choices=Student.PRIVACY_CHOICES)
    major = forms.ModelChoiceField(queryset=Major.objects.all())
21
    graduating_year = forms.IntegerField(label='Graduating Year')
22

Daniel W Bond's avatar
Daniel W Bond committed
23
24
25
26
27
28

class WelcomeNameForm(forms.Form):

    first_name = forms.CharField(label='First Name')
    last_name = forms.CharField(label='Last Name')
    gender = MultiSelectFormField(choices=Student.GENDER_CHOICES, label='Gender Identity (please choose all that apply)')