diff options
Diffstat (limited to 'yaksh/forms.py')
-rw-r--r-- | yaksh/forms.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/yaksh/forms.py b/yaksh/forms.py index f7f7a10..1306e7d 100644 --- a/yaksh/forms.py +++ b/yaksh/forms.py @@ -274,6 +274,17 @@ class QuestionFilterForm(forms.Form): class CourseForm(forms.ModelForm): """ course form for moderators """ + def save(self, commit=True, *args, **kwargs): + instance = super(CourseForm, self).save(commit=False) + if instance.code: + instance.hidden = True + else: + instance.hidden = False + + if commit: + instance.save() + return instance + class Meta: model = Course exclude = ['creator', 'requests', 'students', 'rejected', |