Files
pretix_original/src/pretix/base/plugins.py
2016-08-13 21:19:36 +02:00

26 lines
576 B
Python

from enum import Enum
from typing import List
from django.apps import apps
class PluginType(Enum):
RESTRICTION = 1
PAYMENT = 2
ADMINFEATURE = 3
EXPORT = 4
def get_all_plugins() -> List[type]:
"""
Returns the PretixPluginMeta classes of all plugins found in the installed Django apps.
"""
plugins = []
for app in apps.get_app_configs():
if hasattr(app, 'PretixPluginMeta'):
meta = app.PretixPluginMeta
meta.module = app.name
meta.app = app
plugins.append(meta)
return plugins