mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
Fixed bugs in voucher deletion view
This commit is contained in:
@@ -6,21 +6,14 @@
|
|||||||
<h1>{% trans "Delete voucher" %}</h1>
|
<h1>{% trans "Delete voucher" %}</h1>
|
||||||
<form action="" method="post" class="form-horizontal">
|
<form action="" method="post" class="form-horizontal">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{% if not allowed %}
|
<p>{% blocktrans %}Are you sure you want to delete the voucher <strong>{{ voucher }}</strong>?{% endblocktrans %}</p>
|
||||||
<p>{% trans "You can not delete this voucher after it has been redeemed" %}</p>
|
|
||||||
{% else %}
|
|
||||||
<p>{% blocktrans %}Are you sure you want to delete the voucher
|
|
||||||
<strong>{{ voucher }}</strong>?{% endblocktrans %}</p>
|
|
||||||
{% endif %}
|
|
||||||
<div class="form-group submit-group">
|
<div class="form-group submit-group">
|
||||||
<a href="{% url "control:event.vouchers" organizer=request.event.organizer.slug event=request.event.slug %}" class="btn btn-default btn-cancel">
|
<a href="{% url "control:event.vouchers" organizer=request.event.organizer.slug event=request.event.slug %}" class="btn btn-default btn-cancel">
|
||||||
{% trans "Cancel" %}
|
{% trans "Cancel" %}
|
||||||
</a>
|
</a>
|
||||||
{% if allowed %}
|
|
||||||
<button type="submit" class="btn btn-danger btn-save">
|
<button type="submit" class="btn btn-danger btn-save">
|
||||||
{% trans "Delete" %}
|
{% trans "Delete" %}
|
||||||
</button>
|
</button>
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class VoucherDelete(EventPermissionRequiredMixin, DeleteView):
|
|||||||
if self.get_object().is_ordered():
|
if self.get_object().is_ordered():
|
||||||
messages.error(request, _('A voucher can not be deleted if it already has been redeemed.'))
|
messages.error(request, _('A voucher can not be deleted if it already has been redeemed.'))
|
||||||
return HttpResponseRedirect(self.get_success_url())
|
return HttpResponseRedirect(self.get_success_url())
|
||||||
super().get(request, *args, **kwargs)
|
return super().get(request, *args, **kwargs)
|
||||||
|
|
||||||
@transaction.atomic()
|
@transaction.atomic()
|
||||||
def delete(self, request, *args, **kwargs):
|
def delete(self, request, *args, **kwargs):
|
||||||
|
|||||||
Reference in New Issue
Block a user