mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
Order import: Additional warning for disabling test mode (Z#23208360) (#5494)
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
#
|
||||
from django import forms
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.utils.functional import lazy
|
||||
from django.utils.html import format_html
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from pretix.base.modelimport_orders import get_order_import_columns
|
||||
@@ -71,6 +73,9 @@ class ProcessForm(forms.Form):
|
||||
raise NotImplementedError() # noqa
|
||||
|
||||
|
||||
format_html_lazy = lazy(format_html, str)
|
||||
|
||||
|
||||
class OrdersProcessForm(ProcessForm):
|
||||
orders = forms.ChoiceField(
|
||||
label=_('Import mode'),
|
||||
@@ -91,7 +96,11 @@ class OrdersProcessForm(ProcessForm):
|
||||
)
|
||||
testmode = forms.BooleanField(
|
||||
label=_('Create orders as test mode orders'),
|
||||
required=False
|
||||
required=False,
|
||||
help_text=format_html_lazy(
|
||||
'<div class="alert alert-warning" data-display-dependency="#id_testmode" data-inverse>{}</div>',
|
||||
_('Orders not created in test mode cannot be deleted again after import.')
|
||||
)
|
||||
)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
@@ -100,6 +109,8 @@ class OrdersProcessForm(ProcessForm):
|
||||
initital['testmode'] = self.event.testmode
|
||||
kwargs['initial'] = initital
|
||||
super().__init__(*args, **kwargs)
|
||||
if not self.event.testmode:
|
||||
self.fields["testmode"].help_text = ""
|
||||
|
||||
def get_columns(self):
|
||||
return get_order_import_columns(self.event)
|
||||
|
||||
Reference in New Issue
Block a user