summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhardythe12015-01-14 13:43:41 +0530
committerhardythe12015-01-14 13:43:41 +0530
commit534cc561e22da308e31282ab9c598041558aa1b4 (patch)
tree806972214be0316cd43eb606059802c6b96be0aa
parent69bd6d797129a5292b2752d334b3d4fc39744157 (diff)
downloadonline_test-534cc561e22da308e31282ab9c598041558aa1b4.tar.gz
online_test-534cc561e22da308e31282ab9c598041558aa1b4.tar.bz2
online_test-534cc561e22da308e31282ab9c598041558aa1b4.zip
Added model to store assignment files
-rw-r--r--testapp/exam/models.py11
-rw-r--r--testapp/exam/urls.py2
-rw-r--r--testapp/urls.py2
3 files changed, 13 insertions, 2 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)
diff --git a/testapp/exam/urls.py b/testapp/exam/urls.py
index d71329c..6aa395c 100644
--- a/testapp/exam/urls.py
+++ b/testapp/exam/urls.py
@@ -1,4 +1,4 @@
-from django.conf.urls import patterns, include, url
+from django.conf.urls.defaults import *
urlpatterns = patterns('testapp.exam.views',
url(r'^$', 'index'),
diff --git a/testapp/urls.py b/testapp/urls.py
index 0d126f4..6c19e81 100644
--- a/testapp/urls.py
+++ b/testapp/urls.py
@@ -1,4 +1,4 @@
-from django.conf.urls import patterns, include, url
+from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin