diff --git a/docs/release-notes/version-3.1.md b/docs/release-notes/version-3.1.md index 5369bb935..e827ea139 100644 --- a/docs/release-notes/version-3.1.md +++ b/docs/release-notes/version-3.1.md @@ -10,6 +10,7 @@ * [#8381](https://github.com/netbox-community/netbox/issues/8381) - Add contacts to global search function * [#8462](https://github.com/netbox-community/netbox/issues/8462) - Linkify manufacturer column in device type table * [#8476](https://github.com/netbox-community/netbox/issues/8476) - Bring the ASN Web UI up to the standard set by other objects +* [#8494](https://github.com/netbox-community/netbox/issues/8494) - Include locations count under tenant view ### Bug Fixes diff --git a/netbox/templates/tenancy/tenant.html b/netbox/templates/tenancy/tenant.html index b64438866..fb83a346f 100644 --- a/netbox/templates/tenancy/tenant.html +++ b/netbox/templates/tenancy/tenant.html @@ -59,6 +59,10 @@

{{ stats.rackreservation_count }}

Rack reservations

+
+

{{ stats.location_count }}

+

Locations

+

{{ stats.device_count }}

Devices

diff --git a/netbox/tenancy/views.py b/netbox/tenancy/views.py index e219a5670..4c9fffa1a 100644 --- a/netbox/tenancy/views.py +++ b/netbox/tenancy/views.py @@ -1,9 +1,8 @@ from django.contrib.contenttypes.models import ContentType -from django.http import Http404 from django.shortcuts import get_object_or_404 from circuits.models import Circuit -from dcim.models import Site, Rack, Device, RackReservation, Cable +from dcim.models import Cable, Device, Location, Rack, RackReservation, Site from ipam.models import Aggregate, IPAddress, Prefix, VLAN, VRF, ASN from netbox.views import generic from utilities.tables import paginate_table @@ -103,6 +102,7 @@ class TenantView(generic.ObjectView): 'site_count': Site.objects.restrict(request.user, 'view').filter(tenant=instance).count(), 'rack_count': Rack.objects.restrict(request.user, 'view').filter(tenant=instance).count(), 'rackreservation_count': RackReservation.objects.restrict(request.user, 'view').filter(tenant=instance).count(), + 'location_count': Location.objects.restrict(request.user, 'view').filter(tenant=instance).count(), 'device_count': Device.objects.restrict(request.user, 'view').filter(tenant=instance).count(), 'vrf_count': VRF.objects.restrict(request.user, 'view').filter(tenant=instance).count(), 'prefix_count': Prefix.objects.restrict(request.user, 'view').filter(tenant=instance).count(),