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 = {
'provider': ProviderIndex(),
'circuit': CircuitIndex(),
'providernetwork': ProviderNetworkIndex(),
'provider': ProviderIndex,
'circuit': CircuitIndex,
'providernetwork': ProviderNetworkIndex,
}

View File

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

View File

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

View File

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

View File

@ -15,15 +15,6 @@ def get_app_modules():
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):
name = "search"
verbose_name = "search"

View File

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

View File

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

View File

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