list ops comma-separated in export

This commit is contained in:
Richard Schreiber
2025-12-16 12:23:24 +01:00
parent 823f2708b8
commit 81b7226773

View File

@@ -65,28 +65,16 @@ class ReusableMediaExporter(OrganizerLevelExportMixin, ListExporter):
yield self.ProgressSetTotal(total=media.count())
for medium in media.iterator(chunk_size=1000):
for op in medium.linked_orderpositions:
yield [
medium.type,
medium.identifier,
_('Yes') if medium.active else _('No'),
date_format(medium.expires, 'SHORT_DATETIME_FORMAT') if medium.expires else '',
medium.customer.identifier if medium.customer_id else '',
f"{op.order.code}-{op.positionid}",
medium.linked_giftcard.secret if medium.linked_giftcard_id else '',
medium.notes,
]
else:
yield [
medium.type,
medium.identifier,
_('Yes') if medium.active else _('No'),
date_format(medium.expires, 'SHORT_DATETIME_FORMAT') if medium.expires else '',
medium.customer.identifier if medium.customer_id else '',
'',
medium.linked_giftcard.secret if medium.linked_giftcard_id else '',
medium.notes,
]
yield [
medium.type,
medium.identifier,
_('Yes') if medium.active else _('No'),
date_format(medium.expires, 'SHORT_DATETIME_FORMAT') if medium.expires else '',
medium.customer.identifier if medium.customer_id else '',
', '.join([f"{op.order.code}-{op.positionid}" for op in medium.linked_orderpositions.all()]),
medium.linked_giftcard.secret if medium.linked_giftcard_id else '',
medium.notes,
]
def get_filename(self):
return f'{self.organizer.slug}_media'