mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Closes #8494: Include locations count under tenant view
This commit is contained in:
@ -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
|
||||
|
||||
|
@ -59,6 +59,10 @@
|
||||
<h2><a href="{% url 'dcim:rackreservation_list' %}?tenant_id={{ object.pk }}" class="stat-btn btn {% if stats.rackreservation_count %}btn-primary{% else %}btn-outline-dark{% endif %} btn-lg">{{ stats.rackreservation_count }}</a></h2>
|
||||
<p>Rack reservations</p>
|
||||
</div>
|
||||
<div class="col col-md-4 text-center">
|
||||
<h2><a href="{% url 'dcim:location_list' %}?tenant_id={{ object.pk }}" class="stat-btn btn {% if stats.location_count %}btn-primary{% else %}btn-outline-dark{% endif %} btn-lg">{{ stats.location_count }}</a></h2>
|
||||
<p>Locations</p>
|
||||
</div>
|
||||
<div class="col col-md-4 text-center">
|
||||
<h2><a href="{% url 'dcim:device_list' %}?tenant_id={{ object.pk }}" class="stat-btn btn {% if stats.device_count %}btn-primary{% else %}btn-outline-dark{% endif %} btn-lg">{{ stats.device_count }}</a></h2>
|
||||
<p>Devices</p>
|
||||
|
@ -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(),
|
||||
|
Reference in New Issue
Block a user