Presale: Fix booking period error message logic (Z#23115841) (#3832)

* Fix presale start and end error message logic

* Improve readability
This commit is contained in:
Phin Wolkwitz
2024-01-23 15:58:35 +01:00
committed by GitHub
parent 7022e5bf49
commit 0a154dc79f

View File

@@ -642,10 +642,11 @@ class RedeemView(NoSearchIndexViewMixin, EventViewMixin, CartMixin, TemplateView
context['show_cart'] = context['cart']['positions']
return render(request, 'pretixpresale/event/voucher_form.html', context)
if request.event.presale_start and now() < request.event.presale_start:
err = error_messages['not_started']
if request.event.presale_end and now() > request.event.presale_end:
if request.event.presale_has_ended or (request.event.presale_end and now() > request.event.presale_end):
err = error_messages['ended']
elif not request.event.presale_is_running or (
request.event.presale_start and now() < request.event.presale_start):
err = error_messages['not_started']
self.subevent = None
if request.event.has_subevents: