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

Daniel W Bond's avatar
Daniel W Bond committed
13

14
class StudentUpdateForm(forms.Form):
15

16
17
18
19
20
21
22
    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())
23
    graduating_year = forms.IntegerField(label='Graduating Year')
24

Daniel W Bond's avatar
Daniel W Bond committed
25
26
27
28
29
30

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)')