forked from CGM_Public/pretix_original
Translate errors for addon selection
This commit is contained in:
@@ -10,7 +10,7 @@ from django.dispatch import receiver
|
|||||||
from django.utils.timezone import now
|
from django.utils.timezone import now
|
||||||
from django.utils.translation import pgettext_lazy, ugettext as _
|
from django.utils.translation import pgettext_lazy, ugettext as _
|
||||||
|
|
||||||
from pretix.base.i18n import LazyLocaleException, language
|
from pretix.base.i18n import language
|
||||||
from pretix.base.models import (
|
from pretix.base.models import (
|
||||||
CartPosition, Event, InvoiceAddress, Item, ItemVariation, Voucher,
|
CartPosition, Event, InvoiceAddress, Item, ItemVariation, Voucher,
|
||||||
)
|
)
|
||||||
@@ -27,8 +27,16 @@ from pretix.presale.signals import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class CartError(LazyLocaleException):
|
class CartError(Exception):
|
||||||
pass
|
def __init__(self, *args):
|
||||||
|
msg = args[0]
|
||||||
|
msgargs = args[1] if len(args) > 1 else None
|
||||||
|
self.args = args
|
||||||
|
if msgargs:
|
||||||
|
msg = _(msg) % msgargs
|
||||||
|
else:
|
||||||
|
msg = _(msg)
|
||||||
|
super().__init__(msg)
|
||||||
|
|
||||||
|
|
||||||
error_messages = {
|
error_messages = {
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ from django.http import HttpResponseNotAllowed, JsonResponse
|
|||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
from django.utils import translation
|
from django.utils import translation
|
||||||
from django.utils.functional import cached_property
|
from django.utils.functional import cached_property
|
||||||
from django.utils.translation import pgettext_lazy, ugettext_lazy as _
|
from django.utils.translation import (
|
||||||
|
get_language, pgettext_lazy, ugettext_lazy as _,
|
||||||
|
)
|
||||||
from django.views.generic.base import TemplateResponseMixin
|
from django.views.generic.base import TemplateResponseMixin
|
||||||
|
|
||||||
from pretix.base.models import Order
|
from pretix.base.models import Order
|
||||||
@@ -292,7 +294,7 @@ class AddOnsStep(CartMixin, AsyncAction, TemplateFlowStep):
|
|||||||
return self.get(request, *args, **kwargs)
|
return self.get(request, *args, **kwargs)
|
||||||
|
|
||||||
return self.do(self.request.event.id, data, get_or_create_cart_id(self.request),
|
return self.do(self.request.event.id, data, get_or_create_cart_id(self.request),
|
||||||
invoice_address=self.invoice_address.pk)
|
invoice_address=self.invoice_address.pk, locale=get_language())
|
||||||
|
|
||||||
|
|
||||||
class QuestionsStep(QuestionsViewMixin, CartMixin, TemplateFlowStep):
|
class QuestionsStep(QuestionsViewMixin, CartMixin, TemplateFlowStep):
|
||||||
|
|||||||
Reference in New Issue
Block a user