Skip to content

Commit

Permalink
Allow plugins to register via setuptools, allow for invisible plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelm committed Feb 16, 2016
1 parent c4df20c commit 88d91f8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/pretix/control/views/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ def get_context_data(self, *args, **kwargs) -> dict:
from pretix.base.plugins import get_all_plugins

context = super().get_context_data(*args, **kwargs)
context['plugins'] = [p for p in get_all_plugins() if not p.name.startswith('.')]
context['plugins'] = [p for p in get_all_plugins() if not p.name.startswith('.')
if getattr(p, 'visible', True)]
context['plugins_active'] = self.object.get_plugins()
return context

Expand Down
4 changes: 4 additions & 0 deletions src/pretix/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from django.contrib.messages import constants as messages # NOQA
from django.utils.crypto import get_random_string
from django.utils.translation import ugettext_lazy as _ # NOQA
from pkg_resources import iter_entry_points

config = configparser.ConfigParser()
config.read(['/etc/pretix/pretix.cfg', os.path.expanduser('~/.pretix.cfg'), 'pretix.cfg'],
Expand Down Expand Up @@ -160,6 +161,9 @@
'easy_thumbnails'
]

for entry_point in iter_entry_points(group='pretix.plugin', name=None):
INSTALLED_APPS.append(entry_point.module_name)

MIDDLEWARE_CLASSES = [
'pretix.multidomain.middlewares.MultiDomainMiddleware',
'pretix.multidomain.middlewares.SessionMiddleware',
Expand Down

0 comments on commit 88d91f8

Please sign in to comment.