diff options
author | Sashi20 | 2018-11-02 18:04:38 +0530 |
---|---|---|
committer | GitHub | 2018-11-02 18:04:38 +0530 |
commit | 78ebf02bf04c7ca517afe24852b4283a0906035b (patch) | |
tree | 73fded991d2a74c1e3b8552a86536c4664759a07 /website/models.py | |
parent | a47953cb21b0e9bda909c5cca589fc9d8d8f400c (diff) | |
parent | 23973c6fd3d6e0ac033f0a1a50c2c32e4e1d124d (diff) | |
download | nccps-2018-78ebf02bf04c7ca517afe24852b4283a0906035b.tar.gz nccps-2018-78ebf02bf04c7ca517afe24852b4283a0906035b.tar.bz2 nccps-2018-78ebf02bf04c7ca517afe24852b4283a0906035b.zip |
Merge pull request #46 from Akshen/develop
Allow participants to view and download solutions
Diffstat (limited to 'website/models.py')
-rw-r--r-- | website/models.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/website/models.py b/website/models.py index e482453..ad6b3e4 100644 --- a/website/models.py +++ b/website/models.py @@ -36,10 +36,6 @@ def get_document_dir(instance, filename): return '%s/attachment/%s/%s.%s' % (instance.user, instance.proposal_type, fname+'_'+str(instance.user), fext) -def attachments(instance, filename): - return os.sep.join((instance.workshoptype_name.replace(" ", '_'), filename)) - - class Proposal(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE,) name_of_authors = models.CharField(max_length=200, default='None') @@ -121,6 +117,9 @@ 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): @@ -131,8 +130,7 @@ class AnswerPaper(models.Model): #To upload model for each question -''' + class UploadModel(models.Model): - question = models.ForeignKey(Question, on_delete=models.CASCADE, blank=True, null=True) - model_file = models.FileField(upload_to=attachments) -'''
\ No newline at end of file + question = models.ForeignKey(Question, on_delete=models.CASCADE, blank=True) + model_file = models.FileField(upload_to='uploads/') |