.
This commit is contained in:
+1
-27
@@ -119,7 +119,7 @@ class Case(models.Model):
|
|||||||
# image = models.ImageField()
|
# image = models.ImageField()
|
||||||
description = models.TextField(
|
description = models.TextField(
|
||||||
blank=True,
|
blank=True,
|
||||||
help_text="Description of the case, for admin organisation, will not be visible when taking",
|
help_text="Description of the case",
|
||||||
)
|
)
|
||||||
|
|
||||||
history = models.TextField(null=True, blank=True)
|
history = models.TextField(null=True, blank=True)
|
||||||
@@ -176,32 +176,6 @@ class Case(models.Model):
|
|||||||
examinations = [series.get_examination() for series in self.series.all()]
|
examinations = [series.get_examination() for series in self.series.all()]
|
||||||
return "{}/{} : {}".format(self.pk, self.description, ", ".join(examinations))
|
return "{}/{} : {}".format(self.pk, self.description, ", ".join(examinations))
|
||||||
|
|
||||||
def get_images(self, findings=False):
|
|
||||||
qs = self.images.all()
|
|
||||||
|
|
||||||
if not findings:
|
|
||||||
images = [i.image for i in qs if not i.findings_image]
|
|
||||||
else:
|
|
||||||
images = [i.image for i in qs]
|
|
||||||
|
|
||||||
return images
|
|
||||||
|
|
||||||
def get_image_urls(self):
|
|
||||||
return ",".join(
|
|
||||||
[
|
|
||||||
"https://www.penracourses.org.uk{}".format(i.url)
|
|
||||||
for i in self.get_images()
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
def get_image_url_array(self):
|
|
||||||
return json.dumps(
|
|
||||||
[
|
|
||||||
"https://www.penracourses.org.uk{}".format(i.url)
|
|
||||||
for i in self.get_images()
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class SeriesImage(models.Model):
|
class SeriesImage(models.Model):
|
||||||
image = models.FileField(upload_to=image_directory_path)
|
image = models.FileField(upload_to=image_directory_path)
|
||||||
|
|||||||
Reference in New Issue
Block a user