diff options
Diffstat (limited to 'yaksh/forms.py')
-rw-r--r-- | yaksh/forms.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/yaksh/forms.py b/yaksh/forms.py index 1226fe2..23131b7 100644 --- a/yaksh/forms.py +++ b/yaksh/forms.py @@ -1,9 +1,9 @@ from django import forms -from yaksh.models import get_model_class, Profile, Quiz, Question, TestCase, Course, StandardTestCase, StdoutBasedTestCase +from yaksh.models import get_model_class, Profile, Quiz, Question, TestCase, Course, StandardTestCase, StdioBasedTestCase from django.contrib.auth import authenticate from django.contrib.auth.models import User -from django.contrib.contenttypes.models import ContentType +from django.contrib.contenttypes.models import ContentType from taggit.managers import TaggableManager from taggit.forms import TagField @@ -33,7 +33,7 @@ question_types = ( test_case_types = ( ("standardtestcase", "Standard Testcase"), - ("stdoutbasedtestcase", "Stdout Based Testcase"), + ("stdiobasedtestcase", "Stdio Based Testcase"), ("mcqtestcase", "MCQ Testcase"), ) @@ -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 |