summaryrefslogtreecommitdiff
path: root/website/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'website/models.py')
-rw-r--r--website/models.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/website/models.py b/website/models.py
index 2481177..ad6b3e4 100644
--- a/website/models.py
+++ b/website/models.py
@@ -34,7 +34,7 @@ def get_document_dir(instance, filename):
fname, fext = os.path.splitext(filename)
# print "----------------->",instance.user
return '%s/attachment/%s/%s.%s' % (instance.user, instance.proposal_type, fname+'_'+str(instance.user), fext)
-
+
class Proposal(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE,)
@@ -117,10 +117,20 @@ class Question(models.Model):
# The date for the question.
question_day = models.DateField()
+ def __str__(self):
+ return u"{0} || {1}".format(self.correct_answer, self.question_day)
+
class AnswerPaper(models.Model):
participant = models.ForeignKey(Profile, on_delete=models.CASCADE)
answered_q = models.ForeignKey(Question, on_delete=models.CASCADE)
validate_ans = models.BooleanField()
- date = models.DateTimeField(auto_now=True) \ No newline at end of file
+ date = models.DateTimeField(auto_now=True)
+
+
+#To upload model for each question
+
+class UploadModel(models.Model):
+ question = models.ForeignKey(Question, on_delete=models.CASCADE, blank=True)
+ model_file = models.FileField(upload_to='uploads/')