8927 cleanup - optimize

This commit is contained in:
Arthur 2022-09-27 14:35:54 -07:00 committed by jeremystretch
parent 632fd99b2f
commit 639a7bd51b
8 changed files with 28 additions and 37 deletions

View File

@ -36,7 +36,7 @@ class ProviderNetworkIndex(SearchMixin):
CIRCUIT_SEARCH_TYPES = { CIRCUIT_SEARCH_TYPES = {
'provider': ProviderIndex(), 'provider': ProviderIndex,
'circuit': CircuitIndex(), 'circuit': CircuitIndex,
'providernetwork': ProviderNetworkIndex(), 'providernetwork': ProviderNetworkIndex,
} }

View File

@ -146,15 +146,15 @@ class PowerFeedIndex(SearchMixin):
DCIM_SEARCH_TYPES = { DCIM_SEARCH_TYPES = {
'site': SiteIndex(), 'site': SiteIndex,
'rack': RackIndex(), 'rack': RackIndex,
'rackreservation': RackReservationIndex(), 'rackreservation': RackReservationIndex,
'location': LocationIndex(), 'location': LocationIndex,
'devicetype': DeviceTypeIndex(), 'devicetype': DeviceTypeIndex,
'device': DeviceIndex(), 'device': DeviceIndex,
'moduletype': ModuleTypeIndex(), 'moduletype': ModuleTypeIndex,
'module': ModuleIndex(), 'module': ModuleIndex,
'virtualchassis': VirtualChassisIndex(), 'virtualchassis': VirtualChassisIndex,
'cable': CableIndex(), 'cable': CableIndex,
'powerfeed': PowerFeedIndex(), 'powerfeed': PowerFeedIndex,
} }

View File

@ -16,5 +16,5 @@ class JournalEntryIndex(SearchMixin):
JOURNAL_SEARCH_TYPES = { JOURNAL_SEARCH_TYPES = {
'journalentry': JournalEntryIndex(), 'journalentry': JournalEntryIndex,
} }

View File

@ -72,11 +72,11 @@ class ServiceIndex(SearchMixin):
IPAM_SEARCH_TYPES = { IPAM_SEARCH_TYPES = {
'vrf': VRFIndex(), 'vrf': VRFIndex,
'aggregate': AggregateIndex(), 'aggregate': AggregateIndex,
'prefix': PrefixIndex(), 'prefix': PrefixIndex,
'ipaddress': IPAddressIndex(), 'ipaddress': IPAddressIndex,
'vlan': VLANIndex(), 'vlan': VLANIndex,
'asn': ASNIndex(), 'asn': ASNIndex,
'service': ServiceIndex(), 'service': ServiceIndex,
} }

View File

@ -15,15 +15,6 @@ def get_app_modules():
yield app.name, app.module yield app.name, app.module
def get_app_submodules(submodule_name):
"""
Searches each app module for the specified submodule - yields tuples of (app_name, module)
"""
for name, module in get_app_modules():
if module_has_submodule(module, submodule_name):
yield name, import_module(f"{name}.{submodule_name}")
class SearchConfig(AppConfig): class SearchConfig(AppConfig):
name = "search" name = "search"
verbose_name = "search" verbose_name = "search"

View File

@ -27,6 +27,6 @@ class ContactIndex(SearchMixin):
TENANCY_SEARCH_TYPES = { TENANCY_SEARCH_TYPES = {
'tenant': TenantIndex(), 'tenant': TenantIndex,
'contact': ContactIndex(), 'contact': ContactIndex,
} }

View File

@ -34,6 +34,6 @@ class VirtualMachineIndex(SearchMixin):
VIRTUALIZATION_SEARCH_TYPES = { VIRTUALIZATION_SEARCH_TYPES = {
'cluster': ClusterIndex(), 'cluster': ClusterIndex,
'virtualmachine': VirtualMachineIndex(), 'virtualmachine': VirtualMachineIndex,
} }

View File

@ -28,6 +28,6 @@ class WirelessLinkIndex(SearchMixin):
WIRELESS_SEARCH_TYPES = { WIRELESS_SEARCH_TYPES = {
'wirelesslan': WirelessLANIndex(), 'wirelesslan': WirelessLANIndex,
'wirelesslink': WirelessLinkIndex(), 'wirelesslink': WirelessLinkIndex,
} }