From e84f2e3ad2934bbbb7810908394d4ee2e0e9b71d Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Wed, 27 Oct 2021 10:10:14 -0400 Subject: [PATCH] Fixes #7601: Correct devices count for locations within global search results --- docs/release-notes/version-3.0.md | 1 + netbox/netbox/constants.py | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/version-3.0.md b/docs/release-notes/version-3.0.md index 5b6bf9855..cba7e56f1 100644 --- a/docs/release-notes/version-3.0.md +++ b/docs/release-notes/version-3.0.md @@ -4,6 +4,7 @@ ### Bug Fixes +* [#7601](https://github.com/netbox-community/netbox/issues/7601) - Correct devices count for locations within global search results * [#7612](https://github.com/netbox-community/netbox/issues/7612) - Strip HTML from custom field descriptions * [#7628](https://github.com/netbox-community/netbox/issues/7628) - Fix `load_yaml` method for custom scripts * [#7643](https://github.com/netbox-community/netbox/issues/7643) - Fix circuit assignment when creating multiple terminations simultaneously diff --git a/netbox/netbox/constants.py b/netbox/netbox/constants.py index ec6daa021..3e935e722 100644 --- a/netbox/netbox/constants.py +++ b/netbox/netbox/constants.py @@ -69,7 +69,13 @@ SEARCH_TYPES = OrderedDict(( }), ('location', { 'queryset': Location.objects.add_related_count( - Location.objects.all(), + Location.objects.add_related_count( + Location.objects.all(), + Device, + 'location', + 'device_count', + cumulative=True + ), Rack, 'location', 'rack_count',