diff options
author | adityacp | 2017-04-27 18:37:19 +0530 |
---|---|---|
committer | adityacp | 2017-04-27 18:37:19 +0530 |
commit | 624e752684125aa525d9b3643cbd7c9b7ba61682 (patch) | |
tree | 726da35ba55acacfde255e31bdc2233600f75395 /yaksh/forms.py | |
parent | b191455c7d9b0f6c3548da174a68c8ab8052abf0 (diff) | |
parent | 2694fd6dd4d37a1a6570792e234998feef21edca (diff) | |
download | online_test-624e752684125aa525d9b3643cbd7c9b7ba61682.tar.gz online_test-624e752684125aa525d9b3643cbd7c9b7ba61682.tar.bz2 online_test-624e752684125aa525d9b3643cbd7c9b7ba61682.zip |
Remove conflicts from views after rebase
Diffstat (limited to 'yaksh/forms.py')
-rw-r--r-- | yaksh/forms.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/yaksh/forms.py b/yaksh/forms.py index b34ad59..5dd56a2 100644 --- a/yaksh/forms.py +++ b/yaksh/forms.py @@ -289,10 +289,21 @@ 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', - 'created_on', 'is_trial', 'teachers'] + 'created_on', 'is_trial', 'hidden', 'teachers'] class ProfileForm(forms.ModelForm): |