summaryrefslogtreecommitdiff
path: root/testapp/exam
diff options
context:
space:
mode:
authorprathamesh2014-06-26 17:08:24 +0530
committerprathamesh2014-06-26 17:08:24 +0530
commitf50f2a37a0908a05a4da1d03f9e3c776d32df74c (patch)
tree55566c1b20a5c127091140fdae3d88c50e4ebe07 /testapp/exam
parentbd70b4d7f748eb3f56ac4b8366e02d113c1be3b9 (diff)
downloadonline_test-f50f2a37a0908a05a4da1d03f9e3c776d32df74c.tar.gz
online_test-f50f2a37a0908a05a4da1d03f9e3c776d32df74c.tar.bz2
online_test-f50f2a37a0908a05a4da1d03f9e3c776d32df74c.zip
changes as per suggestion
Diffstat (limited to 'testapp/exam')
-rw-r--r--testapp/exam/forms.py8
-rw-r--r--testapp/exam/models.py6
2 files changed, 4 insertions, 10 deletions
diff --git a/testapp/exam/forms.py b/testapp/exam/forms.py
index a8e3ae7..a43ba2c 100644
--- a/testapp/exam/forms.py
+++ b/testapp/exam/forms.py
@@ -128,12 +128,11 @@ class QuizForm(forms.Form):
def __init__(self, *args, **kwargs):
super(QuizForm, self).__init__(*args, **kwargs)
- self.QUIZZES = [('', 'Select a prerequisite quiz')]
- self.QUIZZES = self.QUIZZES + \
+ QUIZZES = [('', 'Select a prerequisite quiz')]
+ QUIZZES = QUIZZES + \
list(Quiz.objects.values_list('id','description'))
self.fields['prerequisite'] = forms.CharField(required=False,
- widget=forms.Select(choices=self.QUIZZES))
-
+ widget=forms.Select(choices=QUIZZES))
start_date = forms.DateField(initial=datetime.date.today)
duration = forms.IntegerField(help_text='Will be taken in minutes')
@@ -144,7 +143,6 @@ class QuizForm(forms.Form):
help_text='Will be taken as percentage')
language = forms.CharField(widget=forms.Select(choices=LANGUAGES))
-
def save(self):
start_date = self.cleaned_data["start_date"]
duration = self.cleaned_data["duration"]
diff --git a/testapp/exam/models.py b/testapp/exam/models.py
index 5bb94fd..eb270ae 100644
--- a/testapp/exam/models.py
+++ b/testapp/exam/models.py
@@ -119,7 +119,7 @@ class Quiz(models.Model):
pass_criteria = models.FloatField("Passing percentage", default=40)
# List of prerequisite quizzes to be passed to take this quiz
- prerequisite = models.ForeignKey("self", null=True)
+ prerequisite = models.ForeignKey("Quiz", null=True)
# Programming language for a quiz
language = models.CharField(max_length=20, choices=LANGUAGES)
@@ -161,7 +161,6 @@ class QuestionPaper(models.Model):
for question_set in self.random_questions.all():
marks += question_set.marks * question_set.num_questions
self.total_marks = marks
- return None
def _get_questions_for_answerpaper(self):
""" Returns fixed and random questions for the answer paper"""
@@ -324,7 +323,6 @@ class AnswerPaper(models.Model):
"""Updates the total marks earned by student for this paper."""
marks = sum([x.marks for x in self.answers.filter(marks__gt=0.0)])
self.marks_obtained = marks
- return None
def update_percent(self):
"""Updates the percent gained by the student for this paper."""
@@ -332,7 +330,6 @@ class AnswerPaper(models.Model):
if self.marks_obtained is not None:
percent = self.marks_obtained/self.question_paper.total_marks*100
self.percent = round(percent, 2)
- return None
def update_result(self):
"""
@@ -344,7 +341,6 @@ class AnswerPaper(models.Model):
self.result = "PASSED"
else:
self.result = "FAILED"
- return None
def get_question_answers(self):
"""