Added two new exporters

This commit is contained in:
Raphael Michel
2016-05-31 10:07:00 +02:00
parent d8b7765a9b
commit d8705913b1
5 changed files with 173 additions and 0 deletions

View File

@@ -157,6 +157,21 @@ class JSONExporter(BaseExporter):
return 'pretixdata.json', 'application/json', json.dumps(jo, cls=DjangoJSONEncoder)
class MailExporter(BaseExporter):
identifier = 'mailaddrs'
verbose_name = 'Email addresses (text file)'
def render(self, form_data: dict):
addrs = self.event.orders.values('email')
data = "\r\n".join(set(a['email'] for a in addrs))
return 'pretixemails.txt', 'text/plain', data.encode("utf-8")
@receiver(register_data_exporters, dispatch_uid="exporter_json")
def register_json_export(sender, **kwargs):
return JSONExporter
@receiver(register_data_exporters, dispatch_uid="exporter_mail")
def register_mail_export(sender, **kwargs):
return MailExporter