diff options
Diffstat (limited to 'grades/forms.py')
-rw-r--r-- | grades/forms.py | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/grades/forms.py b/grades/forms.py index 130659d..4f9c9a7 100644 --- a/grades/forms.py +++ b/grades/forms.py @@ -1,8 +1,39 @@ -from grades.models import GradingSystem +from grades.models import GradingSystem, GradeRange from django import forms class GradingSystemForm(forms.ModelForm): + + def __init__(self, *args, **kwargs): + super(GradingSystemForm, self).__init__(*args, **kwargs) + self.fields['name'].widget.attrs.update( + {'class': "form-control", 'placeholder': 'Grading Name'} + ) + self.fields['description'].widget.attrs.update( + {'class': "form-control", + 'placeholder': 'Grading description'} + ) class Meta: model = GradingSystem fields = ['name', 'description'] + + +class GradeRangeForm(forms.ModelForm): + def __init__(self, *args, **kwargs): + super(GradeRangeForm, self).__init__(*args, **kwargs) + self.fields['lower_limit'].widget.attrs.update( + {'class': "form-control", 'placeholder': 'Lower limit'} + ) + self.fields['upper_limit'].widget.attrs.update( + {'class': "form-control", 'placeholder': 'Upper limit'} + ) + self.fields['grade'].widget.attrs.update( + {'class': "form-control", 'placeholder': 'Grade'} + ) + self.fields['description'].widget.attrs.update( + {'class': "form-control", + 'placeholder': 'Description'} + ) + class Meta: + model = GradeRange + fields = "__all__" |