From de977f4818bcb1dfa48fbfbc8b9405db9b379c34 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Mon, 23 Aug 2021 12:03:03 +0200 Subject: [PATCH] event_copy_data Signal: Add quota_map argument --- src/pretix/base/models/event.py | 4 +++- src/pretix/base/signals.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pretix/base/models/event.py b/src/pretix/base/models/event.py index f84e3e8460..0f29c014a9 100644 --- a/src/pretix/base/models/event.py +++ b/src/pretix/base/models/event.py @@ -752,7 +752,9 @@ class Event(EventMixin, LoggedModel): ia.bundled_variation = variation_map[ia.bundled_variation.pk] ia.save() + quota_map = {} for q in Quota.objects.filter(event=other, subevent__isnull=True).prefetch_related('items', 'variations'): + quota_map[q.pk] = q items = list(q.items.all()) vars = list(q.variations.all()) oldid = q.pk @@ -876,7 +878,7 @@ class Event(EventMixin, LoggedModel): event_copy_data.send( sender=self, other=other, tax_map=tax_map, category_map=category_map, item_map=item_map, variation_map=variation_map, - question_map=question_map, checkin_list_map=checkin_list_map + question_map=question_map, checkin_list_map=checkin_list_map, quota_map=quota_map, ) if has_custom_style: diff --git a/src/pretix/base/signals.py b/src/pretix/base/signals.py index 19010ae23e..ca53316e58 100644 --- a/src/pretix/base/signals.py +++ b/src/pretix/base/signals.py @@ -509,7 +509,7 @@ requiredaction_display = EventPluginSignal() event_copy_data = EventPluginSignal() """ -Arguments: "other", ``tax_map``, ``category_map``, ``item_map``, ``question_map``, ``variation_map``, ``checkin_list_map`` +Arguments: "other", ``tax_map``, ``category_map``, ``item_map``, ``question_map``, ``variation_map``, ``checkin_list_map``, ``quota_map`` This signal is sent out when a new event is created as a clone of an existing event, i.e. the settings from the older event are copied to the newer one. You can listen to this @@ -520,7 +520,7 @@ but you might need to modify that data. The ``sender`` keyword argument will contain the event of the **new** event. The ``other`` keyword argument will contain the event to **copy from**. The keyword arguments -``tax_map``, ``category_map``, ``item_map``, ``question_map``, ``variation_map`` and +``tax_map``, ``category_map``, ``item_map``, ``question_map``, ``quota_map``, ``variation_map`` and ``checkin_list_map`` contain mappings from object IDs in the original event to objects in the new event of the respective types. """