mirror of
https://github.com/pretix/pretix.git
synced 2026-05-03 14:54:04 +00:00
Add first_scan variable for PDF tickets (#2051)
This commit is contained in:
@@ -400,6 +400,11 @@ DEFAULT_VARIABLES = OrderedDict((
|
||||
"editor_sample": 4,
|
||||
"evaluate": lambda op, order, ev: str(op.seat.seat_number if op.seat else "")
|
||||
}),
|
||||
("first_scan", {
|
||||
"label": _("Date and time of first scan"),
|
||||
"editor_sample": _("2017-05-31 19:00"),
|
||||
"evaluate": lambda op, order, ev: get_first_scan(op)
|
||||
}),
|
||||
))
|
||||
DEFAULT_IMAGES = OrderedDict([])
|
||||
|
||||
@@ -535,6 +540,17 @@ def get_variables(event):
|
||||
return v
|
||||
|
||||
|
||||
def get_first_scan(op: OrderPosition):
|
||||
scans = list(op.checkins.all())
|
||||
|
||||
if scans:
|
||||
return date_format(
|
||||
list(op.checkins.all())[-1].datetime.astimezone(op.order.event.timezone),
|
||||
"SHORT_DATETIME_FORMAT"
|
||||
)
|
||||
return ""
|
||||
|
||||
|
||||
class Renderer:
|
||||
|
||||
def __init__(self, event, layout, background_file):
|
||||
|
||||
Reference in New Issue
Block a user