def preview_image(instance, sender, *args, **kwargs): """Updates book previews if the rating has changed""" if not ENABLE_PREVIEW_IMAGES or sender not in (Review, ReviewRating): return changed_fields = instance.field_tracker.changed() if len(changed_fields) > 0: edition = instance.book generate_edition_preview_image_task.delay(edition.id)
def preview_image(instance, *args, **kwargs): """create preview image on book create""" if not ENABLE_PREVIEW_IMAGES: return changed_fields = {} if instance.field_tracker: changed_fields = instance.field_tracker.changed() if len(changed_fields) > 0: generate_edition_preview_image_task.delay(instance.id)