forked from CGM_Public/pretix_original
Restructure our python module. A lot.
This commit is contained in:
23
src/pretix/base/plugins.py
Normal file
23
src/pretix/base/plugins.py
Normal file
@@ -0,0 +1,23 @@
|
||||
try: # NOQA
|
||||
from enum import Enum
|
||||
except ImportError: # NOQA
|
||||
from flufl.enum import Enum # remove this dependency when support for python <=3.3 is dropped
|
||||
|
||||
from django.apps import apps
|
||||
|
||||
|
||||
class PluginType(Enum):
|
||||
RESTRICTION = 1
|
||||
|
||||
|
||||
def get_all_plugins() -> "List[class]":
|
||||
"""
|
||||
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
|
||||
plugins.append(meta)
|
||||
return plugins
|
||||
Reference in New Issue
Block a user