diff options
Diffstat (limited to 'testapp/exam')
-rw-r--r-- | testapp/exam/models.py | 11 | ||||
-rw-r--r-- | testapp/exam/urls.py | 2 |
2 files changed, 12 insertions, 1 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'), |