From 2f21a4a007ae9b51fadd7832fe90506f19e309e2 Mon Sep 17 00:00:00 2001 From: jayparikh111 Date: Wed, 21 Mar 2012 17:11:33 +0530 Subject: changes for adding tags in questions --- testapp/exam/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'testapp/exam/models.py') diff --git a/testapp/exam/models.py b/testapp/exam/models.py index 717e02e..4931e44 100644 --- a/testapp/exam/models.py +++ b/testapp/exam/models.py @@ -1,7 +1,7 @@ import datetime from django.db import models from django.contrib.auth.models import User - +from taggit.managers import TaggableManager ################################################################################ class Profile(models.Model): """Profile for a user to store roll number and other details.""" @@ -43,6 +43,7 @@ class Question(models.Model): # Is this question active or not. If it is inactive it will not be used # when creating a QuestionPaper. active = models.BooleanField(default=True) + tags = TaggableManager() def __unicode__(self): return self.summary -- cgit From 4884af693bfb0b9bb70ed6b3d8489267a86d90f9 Mon Sep 17 00:00:00 2001 From: hardythe1 Date: Wed, 21 Mar 2012 19:11:15 +0530 Subject: implemented tagging functionality --- testapp/exam/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'testapp/exam/models.py') diff --git a/testapp/exam/models.py b/testapp/exam/models.py index 4931e44..689e931 100644 --- a/testapp/exam/models.py +++ b/testapp/exam/models.py @@ -1,7 +1,8 @@ import datetime from django.db import models from django.contrib.auth.models import User -from taggit.managers import TaggableManager +from taggit_autocomplete_modified.managers import TaggableManagerAutocomplete as TaggableManager + ################################################################################ class Profile(models.Model): """Profile for a user to store roll number and other details.""" -- cgit From b1ba290f249d84989cb3cc38d018482794582a46 Mon Sep 17 00:00:00 2001 From: hardythe1 Date: Thu, 22 Mar 2012 16:56:22 +0530 Subject: Autocomplete tagging functionality --- testapp/exam/models.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'testapp/exam/models.py') diff --git a/testapp/exam/models.py b/testapp/exam/models.py index 689e931..da45e7d 100644 --- a/testapp/exam/models.py +++ b/testapp/exam/models.py @@ -44,6 +44,8 @@ class Question(models.Model): # Is this question active or not. If it is inactive it will not be used # when creating a QuestionPaper. active = models.BooleanField(default=True) + + #Tags for the Question. tags = TaggableManager() def __unicode__(self): @@ -91,6 +93,10 @@ class Quiz(models.Model): # Description of quiz. description = models.CharField(max_length=256) + + #Tags for the Quiz. + tags = TaggableManager() + class Meta: verbose_name_plural = "Quizzes" -- cgit From c0fcc1181e209192f6d11f2ca521e55e33a4ead7 Mon Sep 17 00:00:00 2001 From: hardythe1 Date: Mon, 2 Apr 2012 18:04:43 +0530 Subject: Question Paper generator changes --- testapp/exam/models.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'testapp/exam/models.py') diff --git a/testapp/exam/models.py b/testapp/exam/models.py index da45e7d..ad3dad8 100644 --- a/testapp/exam/models.py +++ b/testapp/exam/models.py @@ -105,9 +105,13 @@ class Quiz(models.Model): desc = self.description or 'Quiz' return '%s: on %s for %d minutes'%(desc, self.start_date, self.duration) - ################################################################################ class QuestionPaper(models.Model): + quiz = models.ForeignKey(Quiz) + questions = models.ManyToManyField(Question) + +################################################################################ +class AnswerPaper(models.Model): """A question paper for a student -- one per student typically. """ # The user taking this question paper. @@ -118,21 +122,14 @@ class QuestionPaper(models.Model): profile = models.ForeignKey(Profile) # The Quiz to which this question paper is attached to. - quiz = models.ForeignKey(Quiz) + question_paper = models.ForeignKey(QuestionPaper) # The time when this paper was started by the user. start_time = models.DateTimeField() # User's IP which is logged. user_ip = models.CharField(max_length=15) - # Unused currently. - key = models.CharField(max_length=10) - # used to allow/stop a user from retaking the question paper. - active = models.BooleanField(default = True) - - # The questions (a list of ids separated by '|') - questions = models.CharField(max_length=128) # The questions successfully answered (a list of ids separated by '|') questions_answered = models.CharField(max_length=128) -- cgit From 5d7ab20a710e2374a3345b07ed62154456dbd2c8 Mon Sep 17 00:00:00 2001 From: hardythe1 Date: Sat, 14 Apr 2012 06:28:44 +0530 Subject: model changes as per requirnment --- testapp/exam/models.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'testapp/exam/models.py') diff --git a/testapp/exam/models.py b/testapp/exam/models.py index ad3dad8..dd0c033 100644 --- a/testapp/exam/models.py +++ b/testapp/exam/models.py @@ -2,7 +2,7 @@ import datetime from django.db import models from django.contrib.auth.models import User from taggit_autocomplete_modified.managers import TaggableManagerAutocomplete as TaggableManager - +from django.http import HttpResponse ################################################################################ class Profile(models.Model): """Profile for a user to store roll number and other details.""" @@ -120,7 +120,10 @@ class AnswerPaper(models.Model): # The user's profile, we store a reference to make it easier to access the # data. profile = models.ForeignKey(Profile) - + + # All questions that remains to attempt to perticular Student + questions = models.CharField(max_length=128) + # The Quiz to which this question paper is attached to. question_paper = models.ForeignKey(QuestionPaper) @@ -157,7 +160,7 @@ class AnswerPaper(models.Model): def completed_question(self, question_id): """Removes the question from the list of questions and returns - the next.""" +the next.""" qa = self.questions_answered if len(qa) > 0: self.questions_answered = '|'.join([qa, str(question_id)]) @@ -193,7 +196,7 @@ class AnswerPaper(models.Model): except AttributeError: # total_seconds is new in Python 2.7. :( secs = dt.seconds + dt.days*24*3600 - total = self.quiz.duration*60.0 + total = self.question_paper.quiz.duration*60.0 remain = max(total - secs, 0) return int(remain) -- cgit From 6c0d75e784b87ed05e4c138110f987e88a37701b Mon Sep 17 00:00:00 2001 From: hardythe1 Date: Wed, 18 Apr 2012 01:56:51 +0530 Subject: changes for student interface --- testapp/exam/models.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'testapp/exam/models.py') diff --git a/testapp/exam/models.py b/testapp/exam/models.py index dd0c033..04789da 100644 --- a/testapp/exam/models.py +++ b/testapp/exam/models.py @@ -129,6 +129,9 @@ class AnswerPaper(models.Model): # The time when this paper was started by the user. start_time = models.DateTimeField() + + # The time when this paper was ended by the user. + end_time = models.DateTimeField() # User's IP which is logged. user_ip = models.CharField(max_length=15) -- cgit From c12f20984aa75751af89a0d6213bc35924bc593b Mon Sep 17 00:00:00 2001 From: Jay Parikh Date: Mon, 18 Mar 2013 15:11:15 +0530 Subject: Added code snippets for questions --- testapp/exam/models.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'testapp/exam/models.py') diff --git a/testapp/exam/models.py b/testapp/exam/models.py index 04789da..708c7af 100644 --- a/testapp/exam/models.py +++ b/testapp/exam/models.py @@ -44,6 +44,9 @@ class Question(models.Model): # Is this question active or not. If it is inactive it will not be used # when creating a QuestionPaper. active = models.BooleanField(default=True) + + #Code Snippet + snippet = models.CharField(max_length=256) #Tags for the Question. tags = TaggableManager() -- cgit From a89aff61b6bab0859c9f81142aa6be5d0ccc8ba1 Mon Sep 17 00:00:00 2001 From: Hardik Ghaghada Date: Wed, 24 Apr 2013 00:09:55 +0530 Subject: 80 Cols per line, corrected indentation in files & implemented DRY --- testapp/exam/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'testapp/exam/models.py') diff --git a/testapp/exam/models.py b/testapp/exam/models.py index 708c7af..00d32e4 100644 --- a/testapp/exam/models.py +++ b/testapp/exam/models.py @@ -1,7 +1,8 @@ import datetime from django.db import models from django.contrib.auth.models import User -from taggit_autocomplete_modified.managers import TaggableManagerAutocomplete as TaggableManager +from taggit_autocomplete_modified.managers import TaggableManagerAutocomplete\ +as TaggableManager from django.http import HttpResponse ################################################################################ class Profile(models.Model): -- cgit