Fix #1102 -- "View in backend" (doesn't work with custom domains)

This commit is contained in:
Raphael Michel
2019-05-01 13:57:09 +02:00
parent f1b07777bc
commit d029d92a92
2 changed files with 10 additions and 0 deletions

View File

@@ -47,6 +47,11 @@
{% if order.testmode %}
<span class="label label-warning">{% trans "TEST MODE" %}</span>
{% endif %}
{% if backend_user %}
<a href="{% url "control:event.order" event=request.event.slug organizer=request.organizer.slug code=order.code %}" class="btn btn-default">
{% trans "View in backend" %}
</a>
{% endif %}
{% include "pretixpresale/event/fragment_order_status.html" with order=order class="pull-right" %}
<div class="clearfix"></div>
</h2>

View File

@@ -128,6 +128,11 @@ class OrderDetails(EventViewMixin, OrderDetailMixin, CartMixin, TemplateView):
self.order.total != Decimal('0.00') or not self.request.event.settings.invoice_address_not_asked_free
)
ctx['backend_user'] = (
self.request.user.is_authenticated
and self.request.user.has_event_permission(self.request.organizer, self.request.event, 'can_view_orders', request=self.request)
)
if self.order.status == Order.STATUS_PENDING:
ctx['pending_sum'] = self.order.pending_sum