summaryrefslogtreecommitdiff
path: root/testapp/exam/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'testapp/exam/models.py')
-rw-r--r--testapp/exam/models.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/testapp/exam/models.py b/testapp/exam/models.py
index 259f875..2386cd2 100644
--- a/testapp/exam/models.py
+++ b/testapp/exam/models.py
@@ -41,6 +41,9 @@ test_status = (
('completed', 'Completed'),
)
+def get_assignment_dir(instance, filename):
+ return '%s/%s/' % (instance.user.roll_number, instance.assignment.description)
+
###############################################################################
class Question(models.Model):
"""Question for a quiz."""
@@ -381,3 +384,11 @@ class AnswerPaper(models.Model):
def __unicode__(self):
u = self.user
return u'Question paper for {0} {1}'.format(u.first_name, u.last_name)
+
+
+################################################################################
+class AssignmentUpload(models.Model):
+ user = models.ForeignKey(Profile)
+ assignment = models.ForeignKey(Quiz)
+ assignmentQuestion = models.ForeignKey(Question)
+ assignmentFile = models.FileField(upload_to=get_assignment_dir)