def clean(self, *args, **kwargs): super().save(*args, **kwargs) img = Image() self.small_image_path = img.compress_image_tinify(image=self.image) super().save(*args, **kwargs)
def compress_discount_image(sender, instance, **kwargs): img = Image() for image in instance.discount_images.all(): image.small_image_path = img.compress_image_tinify(image=image.image) image.save()
def compress_plus_item_image(sender, instance, **kwargs): img = Image() instance.small_image_path = img.compress_image_tinify(image=instance.image) instance.save()