From 02fb0f76b6b1e69383b8fc61d3aa819d6598f9f8 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Fri, 3 Apr 2020 11:41:15 +0200 Subject: [PATCH] Add Ebookpoint covers. --- requirements/requirements.txt | 2 +- .../migrations/0028_book_cover_ebookpoint.py | 20 +++++++++++++++++++ src/catalogue/models/book.py | 7 +++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 src/catalogue/migrations/0028_book_cover_ebookpoint.py diff --git a/requirements/requirements.txt b/requirements/requirements.txt index e3bfb9cee..90fe2ffe9 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -50,7 +50,7 @@ mutagen>=1.31 sorl-thumbnail==12.5.0 # home-brewed & dependencies -librarian==1.8 +librarian==1.8.2 # celery tasks celery[redis]==4.3.0 diff --git a/src/catalogue/migrations/0028_book_cover_ebookpoint.py b/src/catalogue/migrations/0028_book_cover_ebookpoint.py new file mode 100644 index 000000000..6c6e74cc7 --- /dev/null +++ b/src/catalogue/migrations/0028_book_cover_ebookpoint.py @@ -0,0 +1,20 @@ +# Generated by Django 2.2.10 on 2020-04-03 09:40 + +import catalogue.fields +import catalogue.models.book +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('catalogue', '0027_book_findable'), + ] + + operations = [ + migrations.AddField( + model_name='book', + name='cover_ebookpoint', + field=catalogue.fields.EbookField('cover_ebookpoint', blank=True, max_length=255, null=True, upload_to=catalogue.models.book.UploadToPath('book/cover_ebookpoint/%s.jpg'), verbose_name='cover for Ebookpoint'), + ), + ] diff --git a/src/catalogue/models/book.py b/src/catalogue/models/book.py index d78a751d4..60ef5d53c 100644 --- a/src/catalogue/models/book.py +++ b/src/catalogue/models/book.py @@ -45,6 +45,7 @@ _cover_upload_to = UploadToPath('book/cover/%s.jpg') _cover_thumb_upload_to = UploadToPath('book/cover_thumb/%s.jpg') _cover_api_thumb_upload_to = UploadToPath('book/cover_api_thumb/%s.jpg') _simple_cover_upload_to = UploadToPath('book/cover_simple/%s.jpg') +_cover_ebookpoint_upload_to = UploadToPath('book/cover_ebookpoint/%s.jpg') def _ebook_upload_to(upload_path): @@ -98,6 +99,11 @@ class Book(models.Model): null=True, blank=True, upload_to=_simple_cover_upload_to, max_length=255) + cover_ebookpoint = EbookField( + 'cover_ebookpoint', _('cover for Ebookpoint'), + null=True, blank=True, + upload_to=_cover_ebookpoint_upload_to, + max_length=255) ebook_formats = constants.EBOOK_FORMATS formats = ebook_formats + ['html', 'xml'] @@ -556,6 +562,7 @@ class Book(models.Model): book.cover_thumb.build_delay() book.cover_api_thumb.build_delay() book.simple_cover.build_delay() + book.cover_ebookpoint.build_delay() # Build HTML and ebooks. book.html_file.build_delay() -- 2.20.1