Skip to content

Commit 67945f2

Browse files
committed
Closes #6351: Add aggregates count to tenant view
1 parent 30ffa4c commit 67945f2

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

docs/release-notes/version-2.11.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
* [#6197](https://github.com/netbox-community/netbox/issues/6197) - Introduced `SESSION_COOKIE_NAME` config parameter
88
* [#6318](https://github.com/netbox-community/netbox/issues/6318) - Add OM5 MMF cable type
9+
* [#6351](https://github.com/netbox-community/netbox/issues/6351) - Add aggregates count to tenant view
910

1011
### Bug Fixes
1112

netbox/templates/tenancy/tenant.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ <h2><a href="{% url 'dcim:device_list' %}?tenant_id={{ object.pk }}" class="btn
7676
<h2><a href="{% url 'ipam:vrf_list' %}?tenant_id={{ object.pk }}" class="btn {% if stats.vrf_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.vrf_count }}</a></h2>
7777
<p>VRFs</p>
7878
</div>
79+
<div class="col-md-4 text-center">
80+
<h2><a href="{% url 'ipam:aggregate_list' %}?tenant_id={{ object.pk }}" class="btn {% if stats.aggregate_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.aggregate_count }}</a></h2>
81+
<p>Aggregates</p>
82+
</div>
7983
<div class="col-md-4 text-center">
8084
<h2><a href="{% url 'ipam:prefix_list' %}?tenant_id={{ object.pk }}" class="btn {% if stats.prefix_count %}btn-primary{% else %}btn-default{% endif %} btn-lg">{{ stats.prefix_count }}</a></h2>
8185
<p>Prefixes</p>

netbox/tenancy/views.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from circuits.models import Circuit
22
from dcim.models import Site, Rack, Device, RackReservation
3-
from ipam.models import IPAddress, Prefix, VLAN, VRF
3+
from ipam.models import Aggregate, IPAddress, Prefix, VLAN, VRF
44
from netbox.views import generic
55
from utilities.tables import paginate_table
66
from virtualization.models import VirtualMachine, Cluster
@@ -101,6 +101,7 @@ def get_extra_context(self, request, instance):
101101
'device_count': Device.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
102102
'vrf_count': VRF.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
103103
'prefix_count': Prefix.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
104+
'aggregate_count': Aggregate.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
104105
'ipaddress_count': IPAddress.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
105106
'vlan_count': VLAN.objects.restrict(request.user, 'view').filter(tenant=instance).count(),
106107
'circuit_count': Circuit.objects.restrict(request.user, 'view').filter(tenant=instance).count(),

0 commit comments

Comments
 (0)