diff --git a/docs/release-notes/version-2.11.md b/docs/release-notes/version-2.11.md index ec53dee25..d2ccb5282 100644 --- a/docs/release-notes/version-2.11.md +++ b/docs/release-notes/version-2.11.md @@ -6,6 +6,7 @@ * [#6097](https://github.com/netbox-community/netbox/issues/6097) - Redirect old slug-based object views * [#6109](https://github.com/netbox-community/netbox/issues/6109) - Add device counts to locations table +* [#6125](https://github.com/netbox-community/netbox/issues/6125) - Add locations count to home page ### Bug Fixes (from Beta) diff --git a/netbox/netbox/views/__init__.py b/netbox/netbox/views/__init__.py index 5406e7206..5cf560ada 100644 --- a/netbox/netbox/views/__init__.py +++ b/netbox/netbox/views/__init__.py @@ -16,7 +16,7 @@ from packaging import version from circuits.models import Circuit, Provider from dcim.models import ( - Cable, ConsolePort, Device, DeviceType, Interface, PowerPanel, PowerFeed, PowerPort, Rack, Site, + Cable, ConsolePort, Device, DeviceType, Interface, Location, PowerPanel, PowerFeed, PowerPort, Rack, Site, ) from extras.choices import JobResultStatusChoices from extras.models import ObjectChange, JobResult @@ -56,6 +56,7 @@ class HomeView(View): # Organization 'site_count': Site.objects.restrict(request.user, 'view').count(), + 'location_count': Location.objects.restrict(request.user, 'view').count(), 'tenant_count': Tenant.objects.restrict(request.user, 'view').count(), # DCIM diff --git a/netbox/templates/home.html b/netbox/templates/home.html index e9180eca3..273a78bc9 100644 --- a/netbox/templates/home.html +++ b/netbox/templates/home.html @@ -31,7 +31,17 @@

Sites

{% endif %} -

Geographic locations

+

Discrete points of presence

+ +
+ {% if perms.dcim.view_location %} + {{ stats.location_count }} +

Locations

+ {% else %} + +

Locations

+ {% endif %} +

Locations within sites

{% if perms.tenancy.view_tenant %}