From 1959361810afbb5f1de88b7d717da32979c7235d Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Wed, 10 Apr 2024 13:34:15 +0200 Subject: [PATCH] Fundraising in PDF. --- requirements/requirements.txt | 2 +- src/annoy/models.py | 1 + src/catalogue/fields.py | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 0fa614370..eede89479 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -39,7 +39,7 @@ mutagen==1.45.1 sorl-thumbnail==12.8.0 # home-brewed & dependencies -librarian==24.1 +librarian==24.4.1 # celery tasks celery[redis]==5.2.7 diff --git a/src/annoy/models.py b/src/annoy/models.py index da371fc43..e60e3c024 100644 --- a/src/annoy/models.py +++ b/src/annoy/models.py @@ -116,6 +116,7 @@ class MediaInsertSet(models.Model): file_format = models.CharField(max_length=8, choices=[ ('epub', 'epub'), ('mobi', 'mobi'), + ('pdf', 'pdf'), ]) etag = models.CharField(max_length=64, blank=True) diff --git a/src/catalogue/fields.py b/src/catalogue/fields.py index 94bdb6097..c4dec7e3f 100644 --- a/src/catalogue/fields.py +++ b/src/catalogue/fields.py @@ -251,10 +251,13 @@ class PdfField(EbookField): @staticmethod def transform(wldoc, book): + MediaInsertSet = apps.get_model('annoy', 'MediaInsertSet') return wldoc.as_pdf( morefloats=settings.LIBRARIAN_PDF_MOREFLOATS, cover=get_make_cover(book), - base_url=absolute_url(gallery_url(wldoc.book_info.url.slug)), customizations=['notoc']) + base_url=absolute_url(gallery_url(wldoc.book_info.url.slug)), customizations=['notoc'], + fundraising=MediaInsertSet.get_texts_for('pdf'), + ) def build(self, fieldfile): super().build(fieldfile) -- 2.20.1