mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-23 05:42:17 -06:00
8927 plugin search (#10489)
* #7016 base search classes * 7016 add search indexes * 7016 add search indexes * 7016 add search indexes * 7016 add search indexes * 7016 add search indexes * 7016 add search indexes * 8927 refactor search * 8927 refactor search * 8927 refactor search * 8927 refactor search * 8927 get search choices working * 8927 cleanup - optimize * 8927 use backend search function * 8927 fix for plugin search * 8927 add docs * Move search app to a module under netbox/ * Utilize global registry to register model search classes * Build search form options from registry * Determine search categories from model app by default * Enable dynamic search registration for plugins * Update docs & improve plugin support * Clean up search backend class * Docs for #8927 Co-authored-by: jeremystretch <jstretch@ns1.com>
This commit is contained in:
@@ -9,6 +9,7 @@ from django.template.loader import get_template
|
||||
from extras.plugins.utils import import_object
|
||||
from extras.registry import registry
|
||||
from netbox.navigation import MenuGroup
|
||||
from netbox.search import register_search
|
||||
from utilities.choices import ButtonColorChoices
|
||||
|
||||
|
||||
@@ -60,6 +61,7 @@ class PluginConfig(AppConfig):
|
||||
|
||||
# Default integration paths. Plugin authors can override these to customize the paths to
|
||||
# integrated components.
|
||||
search_indexes = 'search.indexes'
|
||||
graphql_schema = 'graphql.schema'
|
||||
menu = 'navigation.menu'
|
||||
menu_items = 'navigation.menu_items'
|
||||
@@ -69,6 +71,11 @@ class PluginConfig(AppConfig):
|
||||
def ready(self):
|
||||
plugin_name = self.name.rsplit('.', 1)[-1]
|
||||
|
||||
# Search extensions
|
||||
search_indexes = import_object(f"{self.__module__}.{self.search_indexes}") or []
|
||||
for idx in search_indexes:
|
||||
register_search()(idx)
|
||||
|
||||
# Register template content (if defined)
|
||||
template_extensions = import_object(f"{self.__module__}.{self.template_extensions}")
|
||||
if template_extensions is not None:
|
||||
|
||||
Reference in New Issue
Block a user