Skip to content

Commit

Permalink
fix more multidomain stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
jeriox committed Apr 3, 2024
1 parent 9d7e59f commit 7bc42fe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion pretix_wallet/templates/pretix_wallet/pairing.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends "pretix_wallet/wallet_base.html" %}
{% load wallet_tags %}
{% load i18n %}

{% block title %}
Expand All @@ -19,7 +20,7 @@
{% endif %}
<form class="mt-3" method="post">
{% csrf_token %}
<a class="button is-danger is-outlined" href="{% url "plugins:pretix_wallet:transactions" request.organizer.slug %}">{% translate "Cancel" %}</a>
<a class="button is-danger is-outlined" href="{% organizer_url request.organizer "plugins:pretix_wallet:transactions" %}">{% translate "Cancel" %}</a>
<input type="submit" class="button is-success" value="{% translate "Pair" %}" />
</form>
</div>
Expand Down
5 changes: 3 additions & 2 deletions pretix_wallet/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from django.views.generic import ListView, TemplateView
from django.utils.translation import gettext_lazy as _
from pretix.base.models import GiftCardTransaction, Item
from pretix.multidomain.urlreverse import build_absolute_uri
from pretix.presale.utils import _detect_event
from pretix.presale.views.customer import CustomerRequiredMixin
from rest_framework.mixins import RetrieveModelMixin, CreateModelMixin
Expand Down Expand Up @@ -57,14 +58,14 @@ def get_context_data(self, **kwargs):
def post(self, request, *args, **kwargs):
link_token_to_wallet(self.request.organizer, self.request.customer, self.kwargs["token_id"])
messages.success(request, _("Your transponder has been paired succesfully."))
return redirect("plugins:pretix_wallet:transactions", organizer=self.request.organizer.slug)
return redirect(build_absolute_uri(self.request.organizer, "plugins:pretix_wallet:transactions"))


class RemovePairingView(CustomerRequiredMixin, WalletRequiredMixin, View):
def post(self, request, *args, **kwargs):
self.request.customer.wallet.giftcard.linked_media.clear()
messages.success(request, _("Your transponder has been unpaired succesfully."))
return redirect("plugins:pretix_wallet:transactions", organizer=self.request.organizer.slug)
return redirect(build_absolute_uri(self.request.organizer, "plugins:pretix_wallet:transactions"))


class ProductViewSet(TerminalAuthMixin, ReadOnlyModelViewSet):
Expand Down

0 comments on commit 7bc42fe

Please sign in to comment.