mirror of
https://github.com/pretix/pretix.git
synced 2026-05-16 17:03:58 +00:00
Add deprecated fields
This commit is contained in:
@@ -21,11 +21,11 @@ class PropertyMappingForm(forms.Form):
|
||||
]
|
||||
)
|
||||
|
||||
def __init__(self, pretix_fields, external_fields_id, *args, **kwargs):
|
||||
def __init__(self, pretix_fields, external_fields_id, available_modes, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.fields["pretix_field"] = forms.ChoiceField(
|
||||
label=_("pretix Field"),
|
||||
choices=pretix_fields_choices(pretix_fields),
|
||||
choices=pretix_fields_choices(pretix_fields, kwargs.get("initial", {}).get("pretix_field")),
|
||||
required=False,
|
||||
)
|
||||
if external_fields_id:
|
||||
@@ -40,6 +40,9 @@ class PropertyMappingForm(forms.Form):
|
||||
self.fields["external_field"].choices = [
|
||||
(self["external_field"].value(), self["external_field"].value()),
|
||||
]
|
||||
self.fields["overwrite"].choices = [
|
||||
(key, label) for (key, label) in self.fields["overwrite"].choices if key in available_modes
|
||||
]
|
||||
print(self.fields)
|
||||
|
||||
|
||||
@@ -51,11 +54,12 @@ class PropertyMappingFormSet(formset_factory(
|
||||
)):
|
||||
template_name = "pretixcontrol/datasync/property_mapping_formset.html"
|
||||
|
||||
def __init__(self, pretix_fields, external_fields, prefix, *args, **kwargs):
|
||||
def __init__(self, pretix_fields, external_fields, available_modes, prefix, *args, **kwargs):
|
||||
super().__init__(
|
||||
form_kwargs={
|
||||
"pretix_fields": pretix_fields,
|
||||
"external_fields_id": prefix + "external-fields" if external_fields else None,
|
||||
"available_modes": available_modes,
|
||||
},
|
||||
prefix=prefix,
|
||||
*args, **kwargs)
|
||||
@@ -68,8 +72,9 @@ class PropertyMappingFormSet(formset_factory(
|
||||
return ctx
|
||||
|
||||
|
||||
def pretix_fields_choices(pretix_fields):
|
||||
def pretix_fields_choices(pretix_fields, initial_choice):
|
||||
return [
|
||||
(key, label + " [" + QUESTION_TYPE_IDENTIFIERS[ptype] + "]")
|
||||
for (required_input, key, label, ptype, enum_opts, getter) in pretix_fields
|
||||
(f.key, f.label + " [" + QUESTION_TYPE_IDENTIFIERS[f.type] + "]")
|
||||
for f in pretix_fields
|
||||
if not f.deprecated or f.key == initial_choice
|
||||
]
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
{{ test.hello }}
|
||||
<table class="table table-condensed">
|
||||
<tbody>
|
||||
{% for identifier, display_name, pending, objects in providers %}
|
||||
@@ -20,20 +19,20 @@
|
||||
{% if pending.failed_attempts %}
|
||||
<i class="fa fa-warning"></i>
|
||||
{% blocktrans trimmed with num=pending.failed_attempts max=pending.max_retry_attempts %}
|
||||
Error, retry {{ num }} of {{ max }}
|
||||
Error, retry {{ num }} of {{ max }}.
|
||||
{% endblocktrans %}{% if pending.not_before %},
|
||||
{% blocktrans trimmed with datetime=pending.not_before %}
|
||||
waiting until {{ datetime }}
|
||||
{% blocktrans trimmed with datetime=pending.not_before|date:"SHORT_DATETIME_FORMAT" %}
|
||||
Waiting until {{ datetime }}.
|
||||
{% endblocktrans %}
|
||||
{% endif %}
|
||||
{% elif pending.not_before %}
|
||||
{% blocktrans trimmed with datetime=pending.not_before %}
|
||||
Waiting until {{ datetime }}
|
||||
{% blocktrans trimmed with datetime=pending.not_before|date:"SHORT_DATETIME_FORMAT" %}
|
||||
Waiting until {{ datetime }}.
|
||||
{% endblocktrans %}
|
||||
{% else %}
|
||||
<i class="fa fa-hourglass"></i> {% trans "Pending" %}
|
||||
{% endif %}
|
||||
(triggered by {{ pending.triggered_by }} at {{ pending.triggered }})
|
||||
(triggered by {{ pending.triggered_by }} at {{ pending.triggered|date:"SHORT_DATETIME_FORMAT" }})
|
||||
{% else %}
|
||||
-
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user