X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/c0a7799619e217e2eac724b1a688ad37f0182253..a409c6cc6901eea44c2cbe3a49038eb21f2db18d:/src/dictionary/models.py?ds=sidebyside diff --git a/src/dictionary/models.py b/src/dictionary/models.py index c2891e1c9..d395b231f 100644 --- a/src/dictionary/models.py +++ b/src/dictionary/models.py @@ -46,6 +46,8 @@ class NoteSource(models.Model): @task(ignore_result=True) def build_notes(book): + if not book.findable: + return task_logger.info(book.slug) with transaction.atomic(): book.notesource_set.all().delete() @@ -68,7 +70,6 @@ def build_notes(book): fn_type=fn_type, language=language ) - qualifier_objects = [] for qualifier in qualifiers: obj, created = Qualifier.objects.get_or_create( @@ -76,12 +77,13 @@ def build_notes(book): 'name': FN_QUALIFIERS.get(qualifier, '') }) qualifier_objects.append(obj) - note.qualifiers = qualifier_objects + note.qualifiers.set(qualifier_objects) note.notesource_set.create(book=book, anchor=anchor) Note.objects.filter(notesource=None).delete() def notes_from_book(sender, instance, **kwargs): - build_notes.delay(instance) + if instance.findable: + build_notes.delay(instance) Book.html_built.connect(notes_from_book)