event_copy_data Signal: Add quota_map argument

This commit is contained in:
Raphael Michel
2021-08-23 12:03:03 +02:00
parent a4827fc992
commit de977f4818
2 changed files with 5 additions and 3 deletions

View File

@@ -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:

View File

@@ -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.
"""