forked from CGM_Public/pretix_original
Copy add-ons during event cloning
This commit is contained in:
@@ -8,8 +8,8 @@ from .event import (
|
|||||||
)
|
)
|
||||||
from .invoices import Invoice, InvoiceLine, invoice_filename
|
from .invoices import Invoice, InvoiceLine, invoice_filename
|
||||||
from .items import (
|
from .items import (
|
||||||
Item, ItemCategory, ItemVariation, Question, QuestionOption, Quota,
|
Item, ItemAddOn, ItemCategory, ItemVariation, Question, QuestionOption,
|
||||||
itempicture_upload_to,
|
Quota, itempicture_upload_to,
|
||||||
)
|
)
|
||||||
from .log import LogEntry
|
from .log import LogEntry
|
||||||
from .orders import (
|
from .orders import (
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ class Event(LoggedModel):
|
|||||||
), tz)
|
), tz)
|
||||||
|
|
||||||
def copy_data_from(self, other):
|
def copy_data_from(self, other):
|
||||||
from . import ItemCategory, Item, Question, Quota
|
from . import ItemAddOn, ItemCategory, Item, Question, Quota
|
||||||
self.plugins = other.plugins
|
self.plugins = other.plugins
|
||||||
self.save()
|
self.save()
|
||||||
|
|
||||||
@@ -254,6 +254,12 @@ class Event(LoggedModel):
|
|||||||
v.item = i
|
v.item = i
|
||||||
v.save()
|
v.save()
|
||||||
|
|
||||||
|
for ia in ItemAddOn.objects.filter(base_item__event=other).prefetch_related('base_item', 'addon_category'):
|
||||||
|
ia.pk = None
|
||||||
|
ia.base_item = item_map[ia.base_item.pk]
|
||||||
|
ia.addon_category = category_map[ia.addon_category.pk]
|
||||||
|
ia.save()
|
||||||
|
|
||||||
for q in Quota.objects.filter(event=other).prefetch_related('items', 'variations'):
|
for q in Quota.objects.filter(event=other).prefetch_related('items', 'variations'):
|
||||||
items = list(q.items.all())
|
items = list(q.items.all())
|
||||||
vars = list(q.variations.all())
|
vars = list(q.variations.all())
|
||||||
|
|||||||
Reference in New Issue
Block a user