blob: f8c800a2157d1efaa1b4baa735e8263db6d4aa05 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
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']
|