From 29f93bce956af26e1b3ffe5ffc04e02c9f32de59 Mon Sep 17 00:00:00 2001 From: adityacp Date: Thu, 2 Jan 2020 15:34:18 +0530 Subject: Change UI in add grades template --- grades/forms.py | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'grades/forms.py') 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__" -- cgit