diff options
author | adityacp | 2020-01-02 15:34:18 +0530 |
---|---|---|
committer | adityacp | 2020-01-02 15:34:18 +0530 |
commit | 29f93bce956af26e1b3ffe5ffc04e02c9f32de59 (patch) | |
tree | 9d7f566a2d7e5d333d34efa3e1c3fa115a54fa92 /grades/forms.py | |
parent | d60050dcfe7e32dc720e48942c7457860da79d6b (diff) | |
download | online_test-29f93bce956af26e1b3ffe5ffc04e02c9f32de59.tar.gz online_test-29f93bce956af26e1b3ffe5ffc04e02c9f32de59.tar.bz2 online_test-29f93bce956af26e1b3ffe5ffc04e02c9f32de59.zip |
Change UI in add grades template
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__" |