summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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