mirror of
https://github.com/pretix/pretix.git
synced 2026-08-17 11:56:27 +00:00
Show date_to in PDF variable "event_date_range" regardless of event settings
Z#2349533
This commit is contained in:
@@ -100,14 +100,14 @@ class EventMixin:
|
|||||||
"DATETIME_FORMAT" if self.settings.show_times else "DATE_FORMAT"
|
"DATETIME_FORMAT" if self.settings.show_times else "DATE_FORMAT"
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_date_range_display(self, tz=None) -> str:
|
def get_date_range_display(self, tz=None, force_show_end=False) -> str:
|
||||||
"""
|
"""
|
||||||
Returns a formatted string containing the start date and the end date
|
Returns a formatted string containing the start date and the end date
|
||||||
of the event with respect to the current locale and to the ``show_times`` and
|
of the event with respect to the current locale and to the ``show_times`` and
|
||||||
``show_date_to`` settings.
|
``show_date_to`` settings.
|
||||||
"""
|
"""
|
||||||
tz = tz or self.timezone
|
tz = tz or self.timezone
|
||||||
if not self.settings.show_date_to or not self.date_to:
|
if (not self.settings.show_date_to and not force_show_end) or not self.date_to:
|
||||||
return _date(self.date_from.astimezone(tz), "DATE_FORMAT")
|
return _date(self.date_from.astimezone(tz), "DATE_FORMAT")
|
||||||
return daterange(self.date_from.astimezone(tz), self.date_to.astimezone(tz))
|
return daterange(self.date_from.astimezone(tz), self.date_to.astimezone(tz))
|
||||||
|
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ DEFAULT_VARIABLES = OrderedDict((
|
|||||||
("event_date_range", {
|
("event_date_range", {
|
||||||
"label": _("Event date range"),
|
"label": _("Event date range"),
|
||||||
"editor_sample": _("May 31st – June 4th, 2017"),
|
"editor_sample": _("May 31st – June 4th, 2017"),
|
||||||
"evaluate": lambda op, order, ev: ev.get_date_range_display()
|
"evaluate": lambda op, order, ev: ev.get_date_range_display(force_show_end=True)
|
||||||
}),
|
}),
|
||||||
("event_begin", {
|
("event_begin", {
|
||||||
"label": _("Event begin date and time"),
|
"label": _("Event begin date and time"),
|
||||||
|
|||||||
Reference in New Issue
Block a user