X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/e977f7187b10b1bc0a30794cd585c6b840568996..971e08cc34959303fbbc8bc50742c9fbe1d66f53:/src/documents/models/listeners.py diff --git a/src/documents/models/listeners.py b/src/documents/models/listeners.py index d306e4e9..1a022fb2 100644 --- a/src/documents/models/listeners.py +++ b/src/documents/models/listeners.py @@ -3,6 +3,7 @@ # from django.contrib.auth.models import User from django.db import models +import cover.models from documents.models import (Book, Chunk, Image, BookPublishRecord, ImagePublishRecord) from documents.signals import post_publish @@ -53,3 +54,9 @@ def listener_create(sender, instance, created, **kwargs): instance.chunk_set.create(number=1, slug='1') models.signals.post_save.connect(listener_create, sender=Book) + +def cover_changed(sender, instance, created, **kwargs): + for book in instance.book_set.all(): + book.build_cover() +models.signals.post_save.connect(cover_changed, sender=cover.models.Image) +