summaryrefslogtreecommitdiff
path: root/app/photos/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/photos/models.py')
-rw-r--r--app/photos/models.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/photos/models.py b/app/photos/models.py
index fd924f3..4bf3759 100644
--- a/app/photos/models.py
+++ b/app/photos/models.py
@@ -126,8 +126,14 @@ class LuxImage(models.Model):
@cached_property
def get_srcset(self):
srcset = ""
+ length = len(self.sizes.all())
+ print(length)
+ loopnum = 1
for size in self.sizes.all():
- srcset += "%s%s/%s_%s.%s %sw, " % (settings.IMAGES_URL, self.pub_date.strftime("%Y"), self.get_image_name(), size.name, self.get_image_ext(), size.width)
+ srcset += "%s%s/%s_%s.%s %sw" % (settings.IMAGES_URL, self.pub_date.strftime("%Y"), self.get_image_name(), size.name, self.get_image_ext(), size.width)
+ if loopnum < length:
+ srcset += ", "
+ loopnum = loopnum+1
return srcset
@cached_property