summaryrefslogtreecommitdiff
path: root/grades/forms.py
blob: 745abffff4a29cc14897140c0d94c3e097876d1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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__"