diff options
author | luxagraf <sng@luxagraf.net> | 2019-11-05 11:14:09 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2019-11-05 11:14:09 -0500 |
commit | 725e3d2f798d228a386466823490b6f25647a4db (patch) | |
tree | 4a4bdfbe7c494a596631bcb7312708dbf2115263 /app/photos | |
parent | f65cea71db9d0ae489f6228d5d2c68dab0bd91ce (diff) |
added updates to posts model
Diffstat (limited to 'app/photos')
-rw-r--r-- | app/photos/models.py | 8 |
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 |