Further work on multi-file-upload

This commit is contained in:
Carl van Tonder
2018-04-23 01:15:33 -04:00
parent bb326bfed8
commit 935af1355b
13 changed files with 235 additions and 58 deletions

View File

@ -17,8 +17,7 @@ from . import validators
class CaseStudyDraft(models.Model):
author = models.ForeignKey(
User,
on_delete=models.CASCADE
User, on_delete=models.CASCADE
)
data = models.TextField()
@ -1001,31 +1000,31 @@ class CaseStudy(models.Model):
##
# 4.1
official_project_documents = models.FileField(
official_project_documents = models.ManyToManyField(
'files.File',
related_name='official_project_document_for',
verbose_name=_("Official project documents"),
help_text=_("Attach any legal or official documents that relate to the project."),
default=None,
null=True,
blank=True,
)
# 4.2
other_documents = models.FileField(
other_documents = models.ManyToManyField(
'files.File',
related_name='other_document_for',
verbose_name=_("Other documents"),
help_text=_("Attach any other documents that relate to the project."),
default=None,
null=True,
blank=True,
)
# 4.3.1
shapefiles = models.FileField(
shapefiles = models.ManyToManyField(
'files.File',
related_name='shapefile_for',
verbose_name=_("Shapefiles"),
help_text=_("If you have territory that you would like to show in relation to this project - e.g. Bienes \
Comunales de Ixtepec etc. This is a set of 3 or more (often 5-6) files with file extensions like \
.cpg, .dbf, .prj, .qpj, .shp, .shx"),
default=None,
null=True,
blank=True
)
@ -1078,7 +1077,6 @@ class CaseStudy(models.Model):
# Continue normal save method by calling original save method.
super(CaseStudy, self).save(*args, **kwargs)
def is_video_youtube(self):
return self.video.count("youtube.com") > 0
@ -1086,7 +1084,6 @@ class CaseStudy(models.Model):
"""Gets the 11 character YouTube video ID from the video field."""
return parse.parse_qs(parse.urlparse(self.video).query)["v"][0]
def is_video_vimeo(self):
return self.video.count("vimeo.com") > 0
@ -1094,7 +1091,6 @@ class CaseStudy(models.Model):
"""Gets the 11 number video ID from the video field."""
return parse.urlparse(self.video).path
def get_negative_case_reasons_no_other(self):
"""Return a list of negative case reasons, minus the 'other' choice (if selected)"""
choices = self.get_negative_case_reasons_list()