mirror of
https://github.com/pretix/pretix.git
synced 2026-09-13 16:14:40 +00:00
Resolve bug in event copy signals of pdf output and badges
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import copy
|
import copy
|
||||||
|
import json
|
||||||
|
|
||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
from django.template.loader import get_template
|
from django.template.loader import get_template
|
||||||
@@ -62,13 +63,21 @@ def copy_item(sender, source, target, **kwargs):
|
|||||||
|
|
||||||
|
|
||||||
@receiver(signal=event_copy_data, dispatch_uid="badges_copy_data")
|
@receiver(signal=event_copy_data, dispatch_uid="badges_copy_data")
|
||||||
def event_copy_data_receiver(sender, other, item_map, **kwargs):
|
def event_copy_data_receiver(sender, other, question_map, item_map, **kwargs):
|
||||||
layout_map = {}
|
layout_map = {}
|
||||||
for bl in other.badge_layouts.all():
|
for bl in other.badge_layouts.all():
|
||||||
oldid = bl.pk
|
oldid = bl.pk
|
||||||
bl = copy.copy(bl)
|
bl = copy.copy(bl)
|
||||||
bl.pk = None
|
bl.pk = None
|
||||||
bl.event = sender
|
bl.event = sender
|
||||||
|
|
||||||
|
layout = json.loads(bl.layout)
|
||||||
|
for o in layout:
|
||||||
|
if o['type'] == 'textarea':
|
||||||
|
if o['content'].startswith('question_'):
|
||||||
|
newq = question_map.get(int(o['content'][9:]))
|
||||||
|
if newq:
|
||||||
|
o['content'] = 'question_{}'.format(newq.pk)
|
||||||
bl.save()
|
bl.save()
|
||||||
|
|
||||||
if bl.background and bl.background.name:
|
if bl.background and bl.background.name:
|
||||||
|
|||||||
@@ -97,7 +97,9 @@ def pdf_event_copy_data_receiver(sender, other, item_map, question_map, **kwargs
|
|||||||
for o in layout:
|
for o in layout:
|
||||||
if o['type'] == 'textarea':
|
if o['type'] == 'textarea':
|
||||||
if o['content'].startswith('question_'):
|
if o['content'].startswith('question_'):
|
||||||
o['content'] = 'question_{}'.format(question_map.get(int(o['content'][9:]), 0).pk)
|
newq = question_map.get(int(o['content'][9:]))
|
||||||
|
if newq:
|
||||||
|
o['content'] = 'question_{}'.format(newq.pk)
|
||||||
bl.layout = json.dumps(layout)
|
bl.layout = json.dumps(layout)
|
||||||
|
|
||||||
bl.save()
|
bl.save()
|
||||||
|
|||||||
Reference in New Issue
Block a user