diff options
Diffstat (limited to 'website/models.py')
-rw-r--r-- | website/models.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/website/models.py b/website/models.py index 2481177..e482453 100644 --- a/website/models.py +++ b/website/models.py @@ -34,7 +34,11 @@ 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) - + + +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,) @@ -123,4 +127,12 @@ 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, null=True) + model_file = models.FileField(upload_to=attachments) +'''
\ No newline at end of file |