mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-24 08:25:17 -06:00
8927 cleanup - optimize
This commit is contained in:
parent
632fd99b2f
commit
639a7bd51b
@ -36,7 +36,7 @@ class ProviderNetworkIndex(SearchMixin):
|
||||
|
||||
|
||||
CIRCUIT_SEARCH_TYPES = {
|
||||
'provider': ProviderIndex(),
|
||||
'circuit': CircuitIndex(),
|
||||
'providernetwork': ProviderNetworkIndex(),
|
||||
'provider': ProviderIndex,
|
||||
'circuit': CircuitIndex,
|
||||
'providernetwork': ProviderNetworkIndex,
|
||||
}
|
||||
|
@ -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,
|
||||
}
|
||||
|
@ -16,5 +16,5 @@ class JournalEntryIndex(SearchMixin):
|
||||
|
||||
|
||||
JOURNAL_SEARCH_TYPES = {
|
||||
'journalentry': JournalEntryIndex(),
|
||||
'journalentry': JournalEntryIndex,
|
||||
}
|
||||
|
@ -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,
|
||||
}
|
||||
|
@ -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"
|
||||
|
@ -27,6 +27,6 @@ class ContactIndex(SearchMixin):
|
||||
|
||||
|
||||
TENANCY_SEARCH_TYPES = {
|
||||
'tenant': TenantIndex(),
|
||||
'contact': ContactIndex(),
|
||||
'tenant': TenantIndex,
|
||||
'contact': ContactIndex,
|
||||
}
|
||||
|
@ -34,6 +34,6 @@ class VirtualMachineIndex(SearchMixin):
|
||||
|
||||
|
||||
VIRTUALIZATION_SEARCH_TYPES = {
|
||||
'cluster': ClusterIndex(),
|
||||
'virtualmachine': VirtualMachineIndex(),
|
||||
'cluster': ClusterIndex,
|
||||
'virtualmachine': VirtualMachineIndex,
|
||||
}
|
||||
|
@ -28,6 +28,6 @@ class WirelessLinkIndex(SearchMixin):
|
||||
|
||||
|
||||
WIRELESS_SEARCH_TYPES = {
|
||||
'wirelesslan': WirelessLANIndex(),
|
||||
'wirelesslink': WirelessLinkIndex(),
|
||||
'wirelesslan': WirelessLANIndex,
|
||||
'wirelesslink': WirelessLinkIndex,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user