summaryrefslogtreecommitdiff
path: root/yaksh/forms.py
diff options
context:
space:
mode:
authorPrabhu Ramachandran2016-09-08 08:37:07 +0530
committerGitHub2016-09-08 08:37:07 +0530
commit68db5b034de8e3fe021a84ed4f64b60679fa3255 (patch)
tree770b9067974b572e3378c40a613567c1c49f4029 /yaksh/forms.py
parent01e08dd15b59ce353043d541c9be81592cda3fe0 (diff)
parent6e2a0db4d67902cca52277d22dd7a67ebd059268 (diff)
downloadonline_test-68db5b034de8e3fe021a84ed4f64b60679fa3255.tar.gz
online_test-68db5b034de8e3fe021a84ed4f64b60679fa3255.tar.bz2
online_test-68db5b034de8e3fe021a84ed4f64b60679fa3255.zip
Merge pull request #132 from maheshgudi/course_changes
added add quiz button to each course
Diffstat (limited to 'yaksh/forms.py')
-rw-r--r--yaksh/forms.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/yaksh/forms.py b/yaksh/forms.py
index 4a20102..23131b7 100644
--- a/yaksh/forms.py
+++ b/yaksh/forms.py
@@ -153,13 +153,14 @@ class QuizForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
user = kwargs.pop('user')
+ course_id = kwargs.pop('course')
super(QuizForm, self).__init__(*args, **kwargs)
self.fields['prerequisite'] = forms.ModelChoiceField(
- queryset=Quiz.objects.filter(course__creator=user))
+ queryset=Quiz.objects.filter(course__id=course_id,
+ is_trial=False))
self.fields['prerequisite'].required = False
self.fields['course'] = forms.ModelChoiceField(
- queryset=Course.objects.filter(Q(creator=user)|
- Q(teachers=user)).distinct())
+ queryset=Course.objects.filter(id=course_id), empty_label=None)
class Meta:
model = Quiz