Commit 735a4115 authored by Daniel W Bond's avatar Daniel W Bond
Browse files

added form for all student updating on single page, cleared unused forms

parent feeff8c0
......@@ -6,53 +6,22 @@ from crispy_forms.layout import Submit, Layout
from crispy_forms.bootstrap import PrependedText, AppendedText
from multiselectfield import MultiSelectFormField
# imports from your apps
from .models import Student
from .models import Student, Room, Major
# form to create student
class StudentForm(forms.ModelForm):
class StudentUpdateForm(forms.Form):
def __init__(self, *args, **kwargs):
self.helper = FormHelper()
self.helper.layout = Layout(
'user',
PrependedText('room', 'Room'),
'class',
AppendedText('major', 'Major'),
)
self.helper.form_method = 'post'
self.helper.add_input(Submit('submit', 'Submit'))
super(StudentForm, self).__init__(*args, **kwargs)
class Meta:
model = Student
class UserSettingsForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
self.helper = FormHelper()
self.helper.layout = Layout(
'user',
PrependedText('room', 'Room'),
'class',
AppendedText('major', 'Major'),
)
self.helper.form_method = 'post'
self.helper.add_input(Submit('submit', 'Submit'))
super(StudentForm, self).__init__(*args, **kwargs)
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())
class Meta:
model = Student
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)')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment