Send checkin list mapping in event_copy_data signal (#1624)

* Send checkin list map in event_copy_data signal

* Add checkin_list_map to documentation and definition of event_copy_data
This commit is contained in:
pajowu
2020-03-25 13:03:45 +01:00
committed by GitHub
parent 3eafec9d6e
commit 30dcda616b
2 changed files with 7 additions and 5 deletions

View File

@@ -622,8 +622,10 @@ class Event(EventMixin, LoggedModel):
q.dependency_question = question_map[q.dependency_question_id] q.dependency_question = question_map[q.dependency_question_id]
q.save(update_fields=['dependency_question']) q.save(update_fields=['dependency_question'])
checkin_list_map = {}
for cl in other.checkin_lists.filter(subevent__isnull=True).prefetch_related('limit_products'): for cl in other.checkin_lists.filter(subevent__isnull=True).prefetch_related('limit_products'):
items = list(cl.limit_products.all()) items = list(cl.limit_products.all())
checkin_list_map[cl.pk] = cl
cl.pk = None cl.pk = None
cl.event = self cl.event = self
cl.save() cl.save()
@@ -678,7 +680,7 @@ class Event(EventMixin, LoggedModel):
event_copy_data.send( event_copy_data.send(
sender=self, other=other, sender=self, other=other,
tax_map=tax_map, category_map=category_map, item_map=item_map, variation_map=variation_map, tax_map=tax_map, category_map=category_map, item_map=item_map, variation_map=variation_map,
question_map=question_map question_map=question_map, checkin_list_map=checkin_list_map
) )
def get_payment_providers(self, cached=False) -> dict: def get_payment_providers(self, cached=False) -> dict:

View File

@@ -482,7 +482,7 @@ As with all event-plugin signals, the ``sender`` keyword argument will contain t
""" """
event_copy_data = EventPluginSignal( event_copy_data = EventPluginSignal(
providing_args=["other", "tax_map", "category_map", "item_map", "question_map", "variation_map"] providing_args=["other", "tax_map", "category_map", "item_map", "question_map", "variation_map", "checkin_list_map"]
) )
""" """
This signal is sent out when a new event is created as a clone of an existing event, i.e. This signal is sent out when a new event is created as a clone of an existing event, i.e.
@@ -494,9 +494,9 @@ but you might need to modify that data.
The ``sender`` keyword argument will contain the event of the **new** event. The ``other`` 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 keyword argument will contain the event to **copy from**. The keyword arguments
``tax_map``, ``category_map``, ``item_map``, ``question_map``, and ``variation_map`` contain ``tax_map``, ``category_map``, ``item_map``, ``question_map``, ``variation_map`` and
mappings from object IDs in the original event to objects in the new event of the respective ``checkin_list_map`` contain mappings from object IDs in the original event to objects
types. in the new event of the respective types.
""" """
item_copy_data = EventPluginSignal( item_copy_data = EventPluginSignal(