mirror of
https://github.com/pretix/pretix.git
synced 2026-05-03 14:54:04 +00:00
Fix localization and timezone issue in widget
This commit is contained in:
@@ -323,6 +323,10 @@ class Event(EventMixin, LoggedModel):
|
||||
else:
|
||||
return get_connection(fail_silently=False)
|
||||
|
||||
@property
|
||||
def timezone(self):
|
||||
return pytz.timezone(self.settings.timezone)
|
||||
|
||||
@property
|
||||
def payment_term_last(self):
|
||||
"""
|
||||
|
||||
@@ -12,6 +12,7 @@ from django.template import Context, Engine
|
||||
from django.template.loader import get_template
|
||||
from django.utils.formats import date_format
|
||||
from django.utils.timezone import now
|
||||
from django.utils.translation import gettext
|
||||
from django.views import View
|
||||
from django.views.decorators.cache import cache_page
|
||||
from django.views.decorators.http import condition
|
||||
@@ -225,14 +226,14 @@ class WidgetAPIProductList(View):
|
||||
|
||||
if not ev.presale_is_running:
|
||||
if ev.presale_has_ended:
|
||||
data['error'] = 'The presale period for this event is over.'
|
||||
data['error'] = gettext('The presale period for this event is over.')
|
||||
elif request.event.settings.presale_start_show_date:
|
||||
data['error'] = 'The presale for this event will start on %(date)s at %(time)s.' % {
|
||||
'date': date_format(ev.presale_start, "SHORT_DATE_FORMAT"),
|
||||
'time': date_format(ev.presale_start, "TIME_FORMAT"),
|
||||
data['error'] = gettext('The presale for this event will start on %(date)s at %(time)s.') % {
|
||||
'date': date_format(ev.presale_start.astimezone(request.event.timezone), "SHORT_DATE_FORMAT"),
|
||||
'time': date_format(ev.presale_start.astimezone(request.event.timezone), "TIME_FORMAT"),
|
||||
}
|
||||
else:
|
||||
data['error'] = 'The presale for this event has not yet started.'
|
||||
data['error'] = gettext('The presale for this event has not yet started.')
|
||||
|
||||
self.voucher = None
|
||||
if 'voucher' in request.GET:
|
||||
|
||||
Reference in New Issue
Block a user