CSV exports: Subevent name and date in separate columns

This commit is contained in:
Raphael Michel
2019-11-28 10:24:12 +01:00
parent ef555eaff1
commit a10082a46f
2 changed files with 18 additions and 2 deletions

View File

@@ -278,6 +278,8 @@ class OrderListExporter(MultiSheetListExporter):
]
if self.event.has_subevents:
headers.append(pgettext('subevent', 'Date'))
headers.append(_('Start date'))
headers.append(_('End date'))
headers += [
_('Product'),
_('Variation'),
@@ -323,7 +325,12 @@ class OrderListExporter(MultiSheetListExporter):
order.datetime.astimezone(tz).strftime('%Y-%m-%d'),
]
if self.event.has_subevents:
row.append(op.subevent)
row.append(op.subevent.name)
row.append(op.subevent.date_from.astimezone(self.event.timezone).strftime('%Y-%m-%d %H:%M:%S'))
if op.subevent.date_to:
row.append(op.subevent.date_to.astimezone(self.event.timezone).strftime('%Y-%m-%d %H:%M:%S'))
else:
row.append('')
row += [
str(op.item),
str(op.variation) if op.variation else '',

View File

@@ -339,6 +339,8 @@ class CSVCheckinList(CheckInListMixin, ListExporter):
if self.event.has_subevents:
headers.append(pgettext('subevent', 'Date'))
headers.append(_('Start date'))
headers.append(_('End date'))
for q in questions:
headers.append(str(q.question))
@@ -389,7 +391,14 @@ class CSVCheckinList(CheckInListMixin, ListExporter):
row.append(op.secret)
row.append(op.attendee_email or (op.addon_to.attendee_email if op.addon_to else '') or op.order.email or '')
if self.event.has_subevents:
row.append(str(op.subevent))
row.append(str(op.subevent.name))
row.append(date_format(op.subevent.date_from.astimezone(self.event.timezone), 'SHORT_DATETIME_FORMAT'))
if op.subevent.date_to:
row.append(
date_format(op.subevent.date_to.astimezone(self.event.timezone), 'SHORT_DATETIME_FORMAT')
)
else:
row.append('')
acache = {}
if op.addon_to:
for a in op.addon_to.answers.all():