From 149903ae7da0968ef3b1b0dc0f329afeaa5a7007 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Mon, 5 Apr 2021 15:03:23 +0200 Subject: [PATCH] Fetch thumbnails from wikidata. --- src/catalogue/models/book.py | 4 +++ .../templates/catalogue/book_text.html | 2 +- src/references/models.py | 28 ++++++++++++++++--- .../static/js/book_text/references.js | 6 +++- .../static/scss/book_text/references.scss | 6 +++- 5 files changed, 39 insertions(+), 7 deletions(-) diff --git a/src/catalogue/models/book.py b/src/catalogue/models/book.py index 5a0f1696f..978bca4f2 100644 --- a/src/catalogue/models/book.py +++ b/src/catalogue/models/book.py @@ -677,6 +677,10 @@ class Book(models.Model): entity.save() Reference.objects.filter(book=self).exclude(entity__uri__in=found).delete() + @property + def references(self): + return self.reference_set.all().select_related('entity') + @classmethod @transaction.atomic def repopulate_ancestors(cls): diff --git a/src/catalogue/templates/catalogue/book_text.html b/src/catalogue/templates/catalogue/book_text.html index 27601d87d..e10bc9689 100644 --- a/src/catalogue/templates/catalogue/book_text.html +++ b/src/catalogue/templates/catalogue/book_text.html @@ -182,7 +182,7 @@ {% localize off %}