From 615d3c841bf028c927aa3633b46e22850b94e30f Mon Sep 17 00:00:00 2001 From: Roman Prykhodchenko Date: Mon, 15 May 2017 08:42:09 +0200 Subject: [PATCH] Filtering by configuration path and module for more objects (#3060) This patch adds ability to filter objects DataCenterAsset, DCHost, VirtualServer or CloudHost types by their configuration_path.module and configuration_path.path. --- src/ralph/data_center/admin.py | 5 +++-- src/ralph/virtual/admin.py | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ralph/data_center/admin.py b/src/ralph/data_center/admin.py index a652b8d624..745781c103 100644 --- a/src/ralph/data_center/admin.py +++ b/src/ralph/data_center/admin.py @@ -343,7 +343,7 @@ class DataCenterAssetAdmin( 'status', 'barcode', 'sn', 'hostname', 'invoice_no', 'invoice_date', 'order_no', 'model__name', ('model__category', RelatedAutocompleteFieldListFilter), 'service_env', - 'configuration_path', + 'configuration_path__path', ('configuration_path__module', TreeRelatedAutocompleteFilterWithDescendants), # noqa MacAddressFilter, 'depreciation_end_date', 'force_depreciation', 'remarks', @@ -568,7 +568,8 @@ class DCHostAdmin(ScanStatusInChangeListMixin, RalphAdmin): list_filter = [ DCHostHostnameFilter, 'service_env', - 'configuration_path', + 'configuration_path__path', + ('configuration_path__module', TreeRelatedAutocompleteFilterWithDescendants), # noqa ('content_type', DCHostTypeListFilter), MacAddressFilter, IPFilter, diff --git a/src/ralph/virtual/admin.py b/src/ralph/virtual/admin.py index 95494edf3c..4e453fe95a 100644 --- a/src/ralph/virtual/admin.py +++ b/src/ralph/virtual/admin.py @@ -98,6 +98,7 @@ class VirtualServerAdmin( list_filter = [ BaseObjectHostnameFilter, 'sn', 'service_env', IPFilter, 'parent', TagsListFilter, MacAddressFilter, + 'configuration_path__path', ('configuration_path__module', TreeRelatedAutocompleteFilterWithDescendants), # noqa ('securityscan__vulnerabilities__patch_deadline', VulnerabilitesByPatchDeadline), # noqa ( @@ -222,6 +223,8 @@ class CloudHostAdmin( list_filter = [ BaseObjectHostnameFilter, 'cloudprovider', 'service_env', 'cloudflavor', TagsListFilter, + 'configuration_path__path', + ('configuration_path__module', TreeRelatedAutocompleteFilterWithDescendants), # noqa ('securityscan__vulnerabilities__patch_deadline', VulnerabilitesByPatchDeadline), # noqa ( 'securityscan__vulnerabilities', RelatedAutocompleteFieldListFilter