Docs for exporters

This commit is contained in:
Raphael Michel
2026-01-29 10:17:14 +01:00
parent ca683e916a
commit 46cf0048c3
2 changed files with 21 additions and 2 deletions

View File

@@ -80,8 +80,24 @@ The exporter class
.. autoattribute:: category .. autoattribute:: category
.. autoattribute:: feature
.. autoattribute:: export_form_fields .. autoattribute:: export_form_fields
.. autoattribute:: repeatable_read
.. automethod:: render .. automethod:: render
This is an abstract method, you **must** override this! This is an abstract method, you **must** override this!
.. automethod:: available_for_user
.. automethod:: get_required_event_permission
On organizer level, by default exporters are expected to handle on a *set of events* and the system will automatically
add a form field that allows the selection of events, limited to events the user has correct permissions for. If this
does not fit your organizer, because it is not related to events, you should **also** inherit from the following class:
.. class:: pretix.base.exporter.OrganizerLevelExportMixin
.. automethod:: get_required_organizer_permission

View File

@@ -183,14 +183,15 @@ class BaseExporter:
def get_required_event_permission(cls) -> str: def get_required_event_permission(cls) -> str:
""" """
The permission level required to use this exporter for events. For multi-event-exports, this will be used The permission level required to use this exporter for events. For multi-event-exports, this will be used
to limit the selection of events. Will be ignored if the `OrganizerLevelExportMixin` mixin is used. to limit the selection of events. Will be ignored if the ``OrganizerLevelExportMixin`` mixin is used.
The default implementation returns ``"event.orders:read"``.
""" """
return 'event.orders:read' return 'event.orders:read'
class OrganizerLevelExportMixin: class OrganizerLevelExportMixin:
@classmethod @classmethod
def required_event_permission(cls): def get_required_event_permission(cls):
raise TypeError("required_event_permission may not be called on OrganizerLevelExportMixin") raise TypeError("required_event_permission may not be called on OrganizerLevelExportMixin")
@classmethod @classmethod
@@ -198,6 +199,8 @@ class OrganizerLevelExportMixin:
""" """
The permission level required to use this exporter. Must be set for organizer-level exports. Set to `None` to The permission level required to use this exporter. Must be set for organizer-level exports. Set to `None` to
allow everyone with any access to the organizer. allow everyone with any access to the organizer.
``get_required_event_permission`` will be ignored on this class.
""" """
raise NotImplementedError() raise NotImplementedError()