summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2020-12-04 11:52:12 -0500
committerluxagraf <sng@luxagraf.net>2020-12-04 11:52:12 -0500
commitee984ff2f1fdca4890a1864e6f71f3e94888e216 (patch)
tree4741f290b6e5d091237218d0f08c225a4183ffed /app
parent7e285bf859b119162f55281a9efd9fe7d122aecb (diff)
fixed another image save bug
Diffstat (limited to 'app')
-rw-r--r--app/media/models.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/media/models.py b/app/media/models.py
index f50af8a..4fb81e3 100644
--- a/app/media/models.py
+++ b/app/media/models.py
@@ -202,7 +202,9 @@ class LuxImage(models.Model):
return False
def save(self, *args, **kwargs):
- self.sizes_cache = ",".join(s.slug for s in self.sizes.all())
+ created = self.pk is None
+ if not created:
+ self.sizes_cache = ",".join(s.slug for s in self.sizes.all())
super(LuxImage, self).save()
@@ -359,7 +361,7 @@ def update_photo_sizes(sender, instance, **kwargs):
sizes = instance.sizes.all()
if sizes:
instance.sizes_cache = ",".join(s.slug for s in sizes)
- print(instance.sizes.all())
+ instance.save()
for size in instance.get_sizes:
print("SIZE is: %s" % size)
# check each size and see if there's an image there already
@@ -393,5 +395,4 @@ def update_photo_sizes(sender, instance, **kwargs):
# file exists, might add something here to force it to do the above when I want
print("file %s exists" % size)
pass
- instance.save()