Commit ce2bd3a7 authored by Daniel W Bond's avatar Daniel W Bond

moved form-control to forms.py in welcome app

parent d68b82de
......@@ -14,7 +14,9 @@ from housing.models import Room
class WelcomeNameForm(forms.Form):
first_name = forms.CharField(required=False, max_length=30)
first_name.widget.attrs['class'] = 'form-control'
last_name = forms.CharField(required=False, max_length=30)
last_name.widget.attrs['class'] = 'form-control'
gender = MultiSelectFormField(choices=Student.GENDER_CHOICES, required=False)
show_gender = BooleanRadioField()
......@@ -23,6 +25,7 @@ class WelcomePrivacyForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(WelcomePrivacyForm, self).__init__(*args, **kwargs)
self.fields['privacy'].widget.attrs['class'] = 'form-control'
if self.instance.recent_changes() > 2:
self.fields['room'].widget = forms.widgets.HiddenInput()
else:
......@@ -47,6 +50,10 @@ class WelcomePrivacyForm(forms.ModelForm):
class WelcomeMajorForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(WelcomeMajorForm, self).__init__(*args, **kwargs)
self.fields['graduating_year'].widget.attrs['class'] = 'form-control'
class Meta:
model = Student
fields = ('major', 'graduating_year', )
......
......@@ -65,9 +65,6 @@ class WelcomeName(LoginRequiredMixin, FormView):
'gender': me.gender,
'show_gender': me.show_gender, })
form.fields['first_name'].widget.attrs['class'] = 'form-control'
form.fields['last_name'].widget.attrs['class'] = 'form-control'
context['my_form'] = form
return context
......@@ -200,7 +197,7 @@ class WelcomeMajor(LoginRequiredMixin, FormView):
form = WelcomeMajorForm(initial={'major': me.major.all(),
'graduating_year': me.graduating_year, })
form.fields['major'].widget.attrs['class'] = 'chosen-select'
form.fields['major'].widget.attrs['class'] = 'form-control chosen-select'
context['my_form'] = form
context['student'] = me
......
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