def _get_plugin_selection_widget(self, hearing): choices = [("", "------")] plugins = getattr(settings, "DEMOCRACY_PLUGINS") if hearing and hearing.pk: current_plugin_identifiers = set(hearing.sections.values_list("plugin_identifier", flat=True)) else: current_plugin_identifiers = set() for plugin_identifier in sorted(current_plugin_identifiers): if plugin_identifier and plugin_identifier not in plugins: # The plugin has been unregistered or something? choices.append((plugin_identifier, plugin_identifier)) for idfr, classpath in sorted(plugins.items()): choices.append((idfr, get_implementation(idfr).display_name or idfr)) widget = forms.Select(choices=choices) return widget
def plugin_implementation(self): return get_implementation(self.plugin_identifier)