mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
PDF Layout: Make pretix logo a layout element, not a background element
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import json
|
||||
|
||||
from django.db import migrations
|
||||
from django.db.models import Q
|
||||
|
||||
|
||||
def add_pretix_logo(app, schema_editor):
|
||||
TicketLayout = app.get_model('ticketoutputpdf', 'TicketLayout')
|
||||
for tl in TicketLayout.objects.filter(Q(background__isnull=True) | Q(background="")):
|
||||
l = json.loads(tl.layout)
|
||||
l.append({"type": "poweredby", "left": "88.72", "bottom": "10.00", "size": "20.00", "content": "dark"})
|
||||
tl.layout = json.dumps(l)
|
||||
tl.save(update_fields=['layout'])
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('ticketoutputpdf', '0002_auto_20180605_2022'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(add_pretix_logo, migrations.RunPython.noop)
|
||||
]
|
||||
@@ -53,7 +53,8 @@ class TicketLayout(LoggedModel):
|
||||
'"type": "textarea"}, {"italic": false, "bottom": "194.50", "align": "left", "fontfamily": "Open '
|
||||
'Sans", "width": "90.00", "left": "102.50", "text": "tdmruoekvkpbv1o2mv8xccvqcikvr58u", "content": '
|
||||
'"secret", "fontsize": "13.0", "bold": false, "color": [0, 0, 0, 1], "type": "textarea"}, '
|
||||
'{"left": "130.40", "bottom": "204.50", "type": "barcodearea", "size": "64.00"}]'
|
||||
'{"left": "130.40", "bottom": "204.50", "type": "barcodearea", "size": "64.00"},{"type":"poweredby",'
|
||||
'"left":"88.72","bottom":"10.00","size":"20.00","content":"dark"}]'
|
||||
)
|
||||
background = models.FileField(null=True, blank=True, upload_to=bg_name, max_length=255)
|
||||
|
||||
|
||||
@@ -157,7 +157,8 @@ class PdfTicketOutput(BaseTicketOutput):
|
||||
{"type": "textarea", "left": "102.50", "bottom": "194.50", "fontsize": "13.0", "color": [0, 0, 0, 1],
|
||||
"fontfamily": "Open Sans", "bold": False, "italic": False, "width": "90.00", "content": "secret",
|
||||
"text": "tdmruoekvkpbv1o2mv8xccvqcikvr58u", "align": "left"},
|
||||
{"type": "barcodearea", "left": "130.40", "bottom": "204.50", "size": "64.00"}
|
||||
{"type": "barcodearea", "left": "130.40", "bottom": "204.50", "size": "64.00"},
|
||||
{"type": "poweredby", "left": "88.72", "bottom": "10.00", "size": "20.00"},
|
||||
]
|
||||
|
||||
def _migrate_from_old_settings(self):
|
||||
|
||||
Reference in New Issue
Block a user