summaryrefslogtreecommitdiff
path: root/app/photos
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2019-11-05 11:14:09 -0500
committerluxagraf <sng@luxagraf.net>2019-11-05 11:14:09 -0500
commit725e3d2f798d228a386466823490b6f25647a4db (patch)
tree4a4bdfbe7c494a596631bcb7312708dbf2115263 /app/photos
parentf65cea71db9d0ae489f6228d5d2c68dab0bd91ce (diff)
added updates to posts model
Diffstat (limited to 'app/photos')
-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