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