Writing an exporter plugin

An Exporter is a method to export the submission or schedule data in pretalx for later use in another program.

In this document, we will walk through the creation of an exporter output plugin step by step.

Please read Creating a plugin first, if you haven’t already.

Exporter registration

The exporter API does not make a lot of usage from signals, but it does use a signal to get a list of all available exporters. Your plugin should listen for this signal and return the subclass of pretalx.common.exporter.BaseExporter that we’ll provide in this plugin:

1
2
3
4
5
6
7
8
9
from django.dispatch import receiver

from pretalx.common.signals import register_data_exporters


@receiver(register_data_exporters, dispatch_uid="exporter_myexporter")
def register_data_exporter(sender, **kwargs):
    from .exporter import MyExporter
    return MyExporter

The exporter class

class pretalx.common.exporter.BaseExporter

The central object of each exporter is the subclass of BaseExporter.

BaseExporter.event
BaseExporter.identifier

A short and unique identifier for this exporter.

This should only contain lower-case letters and in most cases will be the same as your package name.

This is an abstract attribute, you must override this!

BaseExporter.verbose_name

A human-readable name for this exporter.

This should be short but self-explaining. Good examples include ‘JSON’ or ‘Microsoft Excel’.

This is an abstract attribute, you must override this!

BaseExporter.public

Return True if the exported data should be publicly available once the event is public, False otherwise.

This is an abstract attribute, you must override this!

BaseExporter.icon

Return either a fa- string or some other symbol to accompany the exporter in displays.

This is an abstract attribute, you must override this!

BaseExporter.render(**kwargs) → Tuple[str, str, str]

Render the exported file and return a tuple consisting of a file name, a file type and file content.

This is an abstract method, you must override this!

Access

The export will now be available for organisers in the schedule related export view. If you’ve set public = True, it will also show up in the drop down in the event agenda.