Fundraising in PDF.
authorRadek Czajka <rczajka@rczajka.pl>
Wed, 10 Apr 2024 11:34:15 +0000 (13:34 +0200)
committerRadek Czajka <rczajka@rczajka.pl>
Wed, 10 Apr 2024 11:34:15 +0000 (13:34 +0200)
requirements/requirements.txt
src/annoy/models.py
src/catalogue/fields.py

index 0fa6143..eede894 100644 (file)
@@ -39,7 +39,7 @@ mutagen==1.45.1
 sorl-thumbnail==12.8.0
 
 # home-brewed & dependencies
 sorl-thumbnail==12.8.0
 
 # home-brewed & dependencies
-librarian==24.1
+librarian==24.4.1
 
 # celery tasks
 celery[redis]==5.2.7
 
 # celery tasks
 celery[redis]==5.2.7
index da371fc..e60e3c0 100644 (file)
@@ -116,6 +116,7 @@ class MediaInsertSet(models.Model):
     file_format = models.CharField(max_length=8, choices=[
         ('epub', 'epub'),
         ('mobi', 'mobi'),
     file_format = models.CharField(max_length=8, choices=[
         ('epub', 'epub'),
         ('mobi', 'mobi'),
+        ('pdf', 'pdf'),
         ])
     etag = models.CharField(max_length=64, blank=True)
 
         ])
     etag = models.CharField(max_length=64, blank=True)
 
index 94bdb60..c4dec7e 100644 (file)
@@ -251,10 +251,13 @@ class PdfField(EbookField):
 
     @staticmethod
     def transform(wldoc, book):
 
     @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),
         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)
 
     def build(self, fieldfile):
         super().build(fieldfile)