示例#1
0
文件: status.py 项目: arkhi/bookwyrm
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)
示例#2
0
文件: book.py 项目: arkhi/bookwyrm
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)