diff options
Diffstat (limited to 'grades/forms.py')
-rw-r--r-- | grades/forms.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/grades/forms.py b/grades/forms.py new file mode 100644 index 0000000..f8c800a --- /dev/null +++ b/grades/forms.py @@ -0,0 +1,13 @@ +from grades.models import GradingSystem +from django import forms + +class GradingSystemForm(forms.ModelForm): + def __init__(self, *args, ** kwargs): + super(GradingSystemForm, self).__init__(*args, **kwargs) + system = getattr(self, 'instance', None) + if system.name == 'default': + self.fields['name'].widget.attrs['readonly'] = True + + class Meta: + model = GradingSystem + fields = ['name', 'description', 'can_be_used'] |