Allow adding question answers to ticket layouts

This commit is contained in:
Raphael Michel
2017-11-23 20:55:03 +01:00
parent bd7ba09f10
commit bd5d0093ef
3 changed files with 45 additions and 3 deletions

View File

@@ -394,12 +394,15 @@ class Event(EventMixin, LoggedModel):
for v in vars:
q.variations.add(variation_map[v.pk])
question_map = {}
for q in Question.objects.filter(event=other).prefetch_related('items', 'options'):
items = list(q.items.all())
opts = list(q.options.all())
question_map[q.pk] = q
q.pk = None
q.event = self
q.save()
for i in items:
q.items.add(item_map[i.pk])
for o in opts:
@@ -434,6 +437,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
)
def get_payment_providers(self) -> dict:

View File

@@ -253,8 +253,8 @@ 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``, and ``variation_map`` contain mappings
from object IDs in the original event to objects in the new event of the respective
``tax_map``, ``category_map``, ``item_map``, ``question_map``, and ``variation_map`` contain
mappings from object IDs in the original event to objects in the new event of the respective
types.
"""