コード例 #1
0
    def save(self, *args, **kwargs):
        dirty_fields = self.get_dirty_fields()

        super().save(*args, **kwargs)

        if 'photo' in dirty_fields and self.photo:
            optimize_jpeg(self.photo)
コード例 #2
0
    def save(self, *args, **kwargs):
        dirty_fields = self.get_dirty_fields()

        super().save(*args, **kwargs)

        if 'image' in dirty_fields and self.image:
            optimize_jpeg(self.image)
コード例 #3
0
    def save(self, *args, **kwargs):
        dirty_fields = self.get_dirty_fields()

        geodata_changed = list_intersect(dirty_fields.keys(),
                                         ['name', 'address', 'city', 'state', 'postal_code'])

        if geodata_changed:
            self.geocode()

        super().save(*args, **kwargs)

        if 'listing_image' in dirty_fields and self.listing_image:
            optimize_jpeg(self.listing_image)