diff --git a/src/pretix/base/logentrytypes.py b/src/pretix/base/logentrytypes.py index b029042ea..7205d4fe1 100644 --- a/src/pretix/base/logentrytypes.py +++ b/src/pretix/base/logentrytypes.py @@ -4,11 +4,34 @@ from django.urls import reverse from django.utils.html import escape from django.utils.translation import gettext_lazy as _, pgettext_lazy -from pretix.base.models.log import make_link -from pretix.base.signals import EventPluginRegistry +from pretix.base.signals import PluginRegistry -class LogEntryTypeRegistry(EventPluginRegistry): +def make_link(a_map, wrapper, is_active=True, event=None, plugin_name=None): + if a_map: + if is_active: + a_map['val'] = '{val}'.format_map(a_map) + elif event and plugin_name: + a_map['val'] = ( + '{val} ' + '' + ).format_map({ + **a_map, + "errmes": _("The relevant plugin is currently not active. To activate it, click here to go to the plugin settings."), + "plugin_href": reverse('control:event.settings.plugins', kwargs={ + 'organizer': event.organizer.slug, + 'event': event.slug, + }) + '#plugin_' + plugin_name, + }) + else: + a_map['val'] = '{val} '.format_map({ + **a_map, + "errmes": _("The relevant plugin is currently not active."), + }) + return wrapper.format_map(a_map) + + +class LogEntryTypeRegistry(PluginRegistry): def new_from_dict(self, data): def reg(clz): for action_type, plain in data.items(): diff --git a/src/pretix/base/models/log.py b/src/pretix/base/models/log.py index 9eccc8ca5..eeb003d5e 100644 --- a/src/pretix/base/models/log.py +++ b/src/pretix/base/models/log.py @@ -42,7 +42,7 @@ from django.urls import reverse from django.utils.functional import cached_property from django.utils.translation import gettext_lazy as _ -from pretix.base.logentrytypes import log_entry_types +from pretix.base.logentrytypes import log_entry_types, make_link from pretix.base.signals import is_app_active, logentry_object_link @@ -51,30 +51,6 @@ class VisibleOnlyManager(models.Manager): return super().get_queryset().filter(visible=True) -def make_link(a_map, wrapper, is_active=True, event=None, plugin_name=None): - if a_map: - if is_active: - a_map['val'] = '{val}'.format_map(a_map) - elif event and plugin_name: - a_map['val'] = ( - '{val} ' - '' - ).format_map({ - **a_map, - "errmes": _("The relevant plugin is currently not active. To activate it, click here to go to the plugin settings."), - "plugin_href": reverse('control:event.settings.plugins', kwargs={ - 'organizer': event.organizer.slug, - 'event': event.slug, - }) + '#plugin_' + plugin_name, - }) - else: - a_map['val'] = '{val} '.format_map({ - **a_map, - "errmes": _("The relevant plugin is currently not active."), - }) - return wrapper.format_map(a_map) - - class LogEntry(models.Model): """ Represents a change or action that has been performed on another object