summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/media/models.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/app/media/models.py b/app/media/models.py
index b9437f1..d7b79c6 100644
--- a/app/media/models.py
+++ b/app/media/models.py
@@ -122,7 +122,7 @@ class LuxImage(models.Model):
def get_image_filename(self):
return os.path.basename(self.image.path)
- @cached_property
+ @property
def get_srcset(self):
srcset = ""
length = len(self.sizes.all())
@@ -135,13 +135,14 @@ class LuxImage(models.Model):
loopnum = loopnum+1
return srcset
- @cached_property
+ @property
def get_src(self):
src = ""
if self.sizes.all().count() > 1:
- src += "%s%s/%s_%s.%s" % (settings.IMAGES_URL, self.pub_date.strftime("%Y"), self.image_name, 'picwide-med', self.image_ext)
+ src = self.get_image_url_by_size('picwide-med')
else:
- src += "%s%s/%s_%s.%s" % (settings.IMAGES_URL, self.pub_date.strftime("%Y"), self.image_name, [size.name for size in self.sizes.all()], self.image_ext)
+ size = "".join(size.name for size in self.sizes.all())
+ src = self.get_image_url_by_size(size)
return src
def get_image_url_by_size(self, size="original"):