forked from CGM_Public/pretix_original
Allow ticket output methods to opt-out from ZIP generation
This commit is contained in:
@@ -58,6 +58,8 @@ The output class
|
||||
|
||||
.. autoattribute:: is_enabled
|
||||
|
||||
.. autoattribute:: multi_download_enabled
|
||||
|
||||
.. autoattribute:: settings_form_fields
|
||||
|
||||
.. automethod:: settings_content_render
|
||||
|
||||
@@ -32,6 +32,14 @@ class BaseTicketOutput:
|
||||
"""
|
||||
return self.settings.get('_enabled', as_type=bool)
|
||||
|
||||
@property
|
||||
def multi_download_enabled(self) -> bool:
|
||||
"""
|
||||
Returns whether or not the ``generate_order`` method may be called. Returns
|
||||
``True`` by default.
|
||||
"""
|
||||
return True
|
||||
|
||||
def generate(self, position: OrderPosition) -> Tuple[str, str, str]:
|
||||
"""
|
||||
This method should generate the download file and return a tuple consisting of a
|
||||
|
||||
@@ -73,14 +73,16 @@
|
||||
You can download your tickets using the buttons below. Please have your ticket ready when entering the event.
|
||||
{% endblocktrans %}
|
||||
</div>
|
||||
{% if cart.positions|length > 1 %}
|
||||
{% if cart.positions|length > 1 and can_download_multi %}
|
||||
<p>
|
||||
{% trans "Download all tickets at once:" %}
|
||||
{% for b in download_buttons %}
|
||||
<a href="{% eventurl event "presale:event.order.download.combined" secret=order.secret order=order.code output=b.identifier %}"
|
||||
class="btn btn-default btn-sm" data-asyncdownload>
|
||||
<span class="fa fa-download"></span> {{ b.text }}
|
||||
</a>
|
||||
{% if b.multi %}
|
||||
<a href="{% eventurl event "presale:event.order.download.combined" secret=order.secret order=order.code output=b.identifier %}"
|
||||
class="btn btn-default btn-sm" data-asyncdownload>
|
||||
<span class="fa fa-download"></span> {{ b.text }}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
@@ -76,6 +76,7 @@ class OrderDetails(EventViewMixin, OrderDetailMixin, CartMixin, TemplateView):
|
||||
buttons.append({
|
||||
'text': provider.download_button_text or 'Download',
|
||||
'identifier': provider.identifier,
|
||||
'multi': provider.multi_download_enabled
|
||||
})
|
||||
return buttons
|
||||
|
||||
@@ -93,6 +94,7 @@ class OrderDetails(EventViewMixin, OrderDetailMixin, CartMixin, TemplateView):
|
||||
) and self.order.status == Order.STATUS_PAID
|
||||
)
|
||||
ctx['download_buttons'] = self.download_buttons
|
||||
ctx['can_download_multi'] = any([b['multi'] for b in self.download_buttons])
|
||||
ctx['cart'] = self.get_cart(
|
||||
answers=True, downloads=ctx['can_download'],
|
||||
queryset=self.order.positions.all(),
|
||||
|
||||
Reference in New Issue
Block a user