diff options
author | prathamesh | 2016-10-04 16:57:25 +0530 |
---|---|---|
committer | prathamesh | 2016-10-04 16:57:25 +0530 |
commit | c5ae3d4589a71c3f3b9f622c7b67a04277269cde (patch) | |
tree | 78bd889cb40f647db6ba152063dce47ae7b8f430 /yaksh/forms.py | |
parent | 64bb8507cbfbaf8b4558926a0c3206eb85547ed1 (diff) | |
download | online_test-c5ae3d4589a71c3f3b9f622c7b67a04277269cde.tar.gz online_test-c5ae3d4589a71c3f3b9f622c7b67a04277269cde.tar.bz2 online_test-c5ae3d4589a71c3f3b9f622c7b67a04277269cde.zip |
Edit Question Paper Feature.
Can edit question paper.
For creating new and editing existing question paper, same UI and view is used.
Ajax previously used for creation is removed. Not necessary as post
request handles the same.
Removed unnecessary js.
Diffstat (limited to 'yaksh/forms.py')
-rw-r--r-- | yaksh/forms.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/yaksh/forms.py b/yaksh/forms.py index 23131b7..7d4a0d3 100644 --- a/yaksh/forms.py +++ b/yaksh/forms.py @@ -1,6 +1,6 @@ from django import forms -from yaksh.models import get_model_class, Profile, Quiz, Question, TestCase, Course, StandardTestCase, StdioBasedTestCase - +from yaksh.models import get_model_class, Profile, Quiz, Question, TestCase, Course,\ + QuestionPaper, StandardTestCase, StdioBasedTestCase from django.contrib.auth import authenticate from django.contrib.auth.models import User from django.contrib.contenttypes.models import ContentType @@ -195,7 +195,7 @@ class QuestionFilterForm(forms.Form): super(QuestionFilterForm, self).__init__(*args, **kwargs) questions = Question.objects.filter(user_id=user.id) points_list = questions.values_list('points', flat=True).distinct() - points_options = [('select', 'Select Marks')] + points_options = [(None, 'Select Marks')] points_options.extend([(point, point) for point in points_list]) self.fields['marks'] = forms.FloatField(widget=forms.Select\ (choices=points_options)) @@ -211,6 +211,7 @@ class CourseForm(forms.ModelForm): model = Course fields = ['name', 'active', 'enrollment'] + class ProfileForm(forms.ModelForm): """ profile form for students and moderators """ @@ -232,3 +233,9 @@ class ProfileForm(forms.ModelForm): class UploadFileForm(forms.Form): file = forms.FileField() + + +class QuestionPaperForm(forms.ModelForm): + class Meta: + model = QuestionPaper + fields = ['shuffle_questions'] |