python-docx==0.8.11
Wikidata==0.7
-librarian==23.12
+librarian==24.1
## Django
Django==4.1.9
cover_class = request.GET.get('cover_class', 'default')
- cover = make_cover(info, cover_class=cover_class, width=width, height=height)
+ kwargs = {}
+ if chunk.book.project is not None:
+ if chunk.book.project.logo_mono or chunk.book.project.logo:
+ kwargs['cover_logo'] = (chunk.book.project.logo_mono or chunk.book.project.logo).path
+ cover = make_cover(info, cover_class=cover_class, width=width, height=height, **kwargs)
response = HttpResponse(content_type=cover.mime_type())
img = cover.final_image()
img.save(response, cover.format)
(self.ROLE_TRANSLATOR, meta.translators, False)
]:
for person_literal in items:
+ if person_literal is None: continue
if person_literal.lang != 'pl':
if errors is not None:
if obligatory:
--- /dev/null
+# Generated by Django 4.1.9 on 2024-01-30 16:22
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ("documents", "0013_alter_chunkchange_publishable_and_more"),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name="project",
+ name="logo",
+ field=models.FileField(blank=True, upload_to="projects"),
+ ),
+ migrations.AddField(
+ model_name="project",
+ name="logo_mono",
+ field=models.FileField(
+ blank=True, help_text="white on transparent", upload_to="logo_mono"
+ ),
+ ),
+ ]
import os
import shutil
import re
+from urllib.parse import urljoin
class Book(models.Model):
try:
xml = self.materialize(publishable=True).encode('utf-8')
info = BookInfo.from_bytes(xml)
- cover = make_cover(info, width=width, height=height)
+ kwargs = {}
+ if chunk.book.project is not None:
+ if chunk.book.project.logo_mono or chunk.book.project.logo:
+ kwargs['cover_logo'] = (chunk.book.project.logo_mono or chunk.book.project.logo).path
+ cover = make_cover(info, width=width, height=height, **kwargs)
out = BytesIO()
ext = cover.ext()
cover.save(out)
if not fake:
book_xml = self.materialize(changes=changes)
data = {"book_xml": book_xml, "days": days, "hidden": hidden}
+ if self.project is not None:
+ if self.project.logo:
+ data['logo'] = urljoin(
+ 'https://' + Site.objects.get_current().domain,
+ self.project.logo.url,
+ )
+ if self.project.logo_mono:
+ data['logo_mono'] = urljoin(
+ 'https://' + Site.objects.get_current().domain,
+ self.project.logo.url,
+ )
if host:
data['gallery_url'] = host + self.gallery_url()
apiclient.api_call(user, "books/", data, beta=beta)
name = models.CharField(_('name'), max_length=255, unique=True)
notes = models.TextField(_('notes'), blank=True, null=True)
+ logo = models.FileField(upload_to='projects', blank=True)
+ logo_mono = models.FileField(upload_to='logo_mono', help_text='white on transparent', blank=True)
class Meta:
app_label = 'documents'