Prevent missing stylesheets in cloned events

This commit is contained in:
Raphael Michel
2021-05-31 13:24:18 +02:00
parent 85dbc0551b
commit 85b9e4eb94
2 changed files with 11 additions and 2 deletions

View File

@@ -640,6 +640,7 @@ class Event(EventMixin, LoggedModel):
), tz)
def copy_data_from(self, other):
from pretix.presale.style import regenerate_css
from ..signals import event_copy_data
from . import (
Item, ItemAddOn, ItemBundle, ItemCategory, ItemMetaValue, Question,
@@ -819,9 +820,14 @@ class Event(EventMixin, LoggedModel):
s.product = item_map[s.product_id]
s.save()
has_custom_style = other.settings.presale_css_file or other.settings.presale_widget_css_file
skip_settings = (
'ticket_secrets_pretix_sig1_pubkey',
'ticket_secrets_pretix_sig1_privkey',
'presale_css_file',
'presale_css_checksum',
'presale_widget_css_file',
'presale_widget_css_checksum',
)
for s in other.settings._objects.all():
if s.key in skip_settings:
@@ -856,6 +862,9 @@ class Event(EventMixin, LoggedModel):
question_map=question_map, checkin_list_map=checkin_list_map
)
if has_custom_style:
regenerate_css.apply_async(args=(self.pk,))
def get_payment_providers(self, cached=False) -> dict:
"""
Returns a dictionary of initialized payment providers mapped by their identifiers.