Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion netbox/circuits/views.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from django.contrib import messages
from django.db import transaction
from django.db.models import Q
from django.shortcuts import get_object_or_404, redirect, render

from dcim.views import PathTraceView
from netbox.views import generic
from tenancy.views import ObjectContactsView
from utilities.forms import ConfirmationForm
from utilities.utils import count_related
from utilities.views import register_model_view
Expand Down Expand Up @@ -73,6 +73,11 @@ class ProviderBulkDeleteView(generic.BulkDeleteView):
table = tables.ProviderTable


@register_model_view(Provider, 'contacts')
class ProviderContactsView(ObjectContactsView):
queryset = Provider.objects.all()


#
# ProviderAccounts
#
Expand Down Expand Up @@ -134,6 +139,11 @@ class ProviderAccountBulkDeleteView(generic.BulkDeleteView):
table = tables.ProviderAccountTable


@register_model_view(ProviderAccount, 'contacts')
class ProviderAccountContactsView(ObjectContactsView):
queryset = ProviderAccount.objects.all()


#
# Provider networks
#
Expand Down Expand Up @@ -389,6 +399,11 @@ def post(self, request, pk):
})


@register_model_view(Circuit, 'contacts')
class CircuitContactsView(ObjectContactsView):
queryset = Circuit.objects.all()


#
# Circuit terminations
#
Expand Down
41 changes: 41 additions & 0 deletions netbox/dcim/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from ipam.models import ASN, IPAddress, Prefix, VLAN, VLANGroup
from ipam.tables import InterfaceVLANTable
from netbox.views import generic
from tenancy.views import ObjectContactsView
from utilities.forms import ConfirmationForm
from utilities.paginator import EnhancedPaginator, get_paginate_count
from utilities.permissions import get_permission_for_model
Expand Down Expand Up @@ -267,6 +268,11 @@ class RegionBulkDeleteView(generic.BulkDeleteView):
table = tables.RegionTable


@register_model_view(Region, 'contacts')
class RegionContactsView(ObjectContactsView):
queryset = Region.objects.all()


#
# Site groups
#
Expand Down Expand Up @@ -342,6 +348,11 @@ class SiteGroupBulkDeleteView(generic.BulkDeleteView):
table = tables.SiteGroupTable


@register_model_view(SiteGroup, 'contacts')
class SiteGroupContactsView(ObjectContactsView):
queryset = SiteGroup.objects.all()


#
# Sites
#
Expand Down Expand Up @@ -435,6 +446,11 @@ class SiteBulkDeleteView(generic.BulkDeleteView):
table = tables.SiteTable


@register_model_view(Site, 'contacts')
class SiteContactsView(ObjectContactsView):
queryset = Site.objects.all()


#
# Locations
#
Expand Down Expand Up @@ -523,6 +539,11 @@ class LocationBulkDeleteView(generic.BulkDeleteView):
table = tables.LocationTable


@register_model_view(Location, 'contacts')
class LocationContactsView(ObjectContactsView):
queryset = Location.objects.all()


#
# Rack roles
#
Expand Down Expand Up @@ -740,6 +761,11 @@ class RackBulkDeleteView(generic.BulkDeleteView):
table = tables.RackTable


@register_model_view(Rack, 'contacts')
class RackContactsView(ObjectContactsView):
queryset = Rack.objects.all()


#
# Rack reservations
#
Expand Down Expand Up @@ -874,6 +900,11 @@ class ManufacturerBulkDeleteView(generic.BulkDeleteView):
table = tables.ManufacturerTable


@register_model_view(Manufacturer, 'contacts')
class ManufacturerContactsView(ObjectContactsView):
queryset = Manufacturer.objects.all()


#
# Device types
#
Expand Down Expand Up @@ -2088,6 +2119,11 @@ class DeviceBulkRenameView(generic.BulkRenameView):
table = tables.DeviceTable


@register_model_view(Device, 'contacts')
class DeviceContactsView(ObjectContactsView):
queryset = Device.objects.all()


#
# Modules
#
Expand Down Expand Up @@ -3469,6 +3505,11 @@ class PowerPanelBulkDeleteView(generic.BulkDeleteView):
table = tables.PowerPanelTable


@register_model_view(PowerPanel, 'contacts')
class PowerPanelContactsView(ObjectContactsView):
queryset = PowerPanel.objects.all()


#
# Power feeds
#
Expand Down
6 changes: 6 additions & 0 deletions netbox/ipam/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from dcim.filtersets import InterfaceFilterSet
from dcim.models import Interface, Site
from netbox.views import generic
from tenancy.views import ObjectContactsView
from utilities.utils import count_related
from utilities.views import ViewTab, register_model_view
from virtualization.filtersets import VMInterfaceFilterSet
Expand Down Expand Up @@ -1291,6 +1292,11 @@ class L2VPNBulkDeleteView(generic.BulkDeleteView):
table = tables.L2VPNTable


@register_model_view(L2VPN, 'contacts')
class L2VPNContactsView(ObjectContactsView):
queryset = L2VPN.objects.all()


#
# L2VPN terminations
#
Expand Down
1 change: 0 additions & 1 deletion netbox/templates/circuits/circuit.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ <h5 class="card-header">Circuit</h5>
<div class="col col-md-6">
{% include 'circuits/inc/circuit_termination.html' with termination=object.termination_a side='A' %}
{% include 'circuits/inc/circuit_termination.html' with termination=object.termination_z side='Z' %}
{% include 'inc/panels/contacts.html' %}
{% include 'inc/panels/image_attachments.html' %}
{% plugin_right_page object %}
</div>
Expand Down
1 change: 0 additions & 1 deletion netbox/templates/circuits/provider.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ <h5 class="card-header">Provider</h5>
<div class="col col-md-6">
{% include 'inc/panels/related_objects.html' %}
{% include 'inc/panels/custom_fields.html' %}
{% include 'inc/panels/contacts.html' %}
{% plugin_right_page object %}
</div>
</div>
Expand Down
1 change: 0 additions & 1 deletion netbox/templates/circuits/provideraccount.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ <h5 class="card-header">Provider Account</h5>
{% include 'inc/panels/related_objects.html' %}
{% include 'inc/panels/comments.html' %}
{% include 'inc/panels/custom_fields.html' %}
{% include 'inc/panels/contacts.html' %}
{% plugin_right_page object %}
</div>
<div class="col col-md-12">
Expand Down
1 change: 0 additions & 1 deletion netbox/templates/dcim/device.html
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ <h5 class="card-header">Services</h5>
</div>
{% endif %}
</div>
{% include 'inc/panels/contacts.html' %}
{% include 'inc/panels/image_attachments.html' %}
{% if object.rack and object.position %}
<div class="row" style="margin-bottom: 20px">
Expand Down
1 change: 0 additions & 1 deletion netbox/templates/dcim/location.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ <h5 class="card-header">
</div>
<div class="col col-md-6">
{% include 'inc/panels/related_objects.html' %}
{% include 'inc/panels/contacts.html' %}
{% include 'dcim/inc/nonracked_devices.html' %}
{% include 'inc/panels/image_attachments.html' %}
{% plugin_right_page object %}
Expand Down
1 change: 0 additions & 1 deletion netbox/templates/dcim/manufacturer.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ <h5 class="card-header">
<div class="col col-md-6">
{% include 'inc/panels/related_objects.html' %}
{% include 'inc/panels/custom_fields.html' %}
{% include 'inc/panels/contacts.html' %}
{% plugin_right_page object %}
</div>
</div>
Expand Down
1 change: 0 additions & 1 deletion netbox/templates/dcim/powerpanel.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ <h5 class="card-header">Power Panel</h5>
<div class="col col-md-6">
{% include 'inc/panels/related_objects.html' %}
{% include 'inc/panels/custom_fields.html' %}
{% include 'inc/panels/contacts.html' %}
{% include 'inc/panels/image_attachments.html' %}
{% plugin_right_page object %}
</div>
Expand Down
1 change: 0 additions & 1 deletion netbox/templates/dcim/rack.html
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ <h4>Rear</h4>
</div>
{% include 'inc/panels/related_objects.html' %}
{% include 'dcim/inc/nonracked_devices.html' %}
{% include 'inc/panels/contacts.html' %}
{% plugin_right_page object %}
</div>
</div>
Expand Down
1 change: 0 additions & 1 deletion netbox/templates/dcim/region.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ <h5 class="card-header">Region</h5>
</div>
<div class="col col-md-6">
{% include 'inc/panels/related_objects.html' %}
{% include 'inc/panels/contacts.html' %}
{% plugin_right_page object %}
</div>
</div>
Expand Down
1 change: 0 additions & 1 deletion netbox/templates/dcim/site.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ <h5 class="card-header">Site</h5>
</div>
<div class="col col-md-6">
{% include 'inc/panels/related_objects.html' with filter_name='site_id' %}
{% include 'inc/panels/contacts.html' %}
<div class="card">
<h5 class="card-header">Locations</h5>
<div class='card-body'>
Expand Down
1 change: 0 additions & 1 deletion netbox/templates/dcim/sitegroup.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ <h5 class="card-header">Site Group</h5>
</div>
{% include 'inc/panels/tags.html' %}
{% include 'inc/panels/custom_fields.html' %}
{% include 'inc/panels/contacts.html' %}
{% plugin_left_page object %}
</div>
<div class="col col-md-6">
Expand Down
63 changes: 0 additions & 63 deletions netbox/templates/inc/panels/contacts.html

This file was deleted.

1 change: 0 additions & 1 deletion netbox/templates/ipam/l2vpn.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ <h5 class="card-header">L2VPN Attributes</h5>
{% plugin_left_page object %}
</div>
<div class="col col-md-6">
{% include 'inc/panels/contacts.html' %}
{% include 'inc/panels/custom_fields.html' %}
{% include 'inc/panels/comments.html' %}
{% plugin_right_page object %}
Expand Down
27 changes: 27 additions & 0 deletions netbox/templates/tenancy/object_contacts.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{% extends base_template %}
{% load helpers %}

{% block extra_controls %}
{% if perms.tenancy.add_contactassignment %}
<a href="{% url 'tenancy:contactassignment_add' %}?content_type={{ object|content_type_id }}&object_id={{ object.pk }}&return_url={{ object.get_absolute_url }}" class="btn btn-primary btn-sm">
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> Add a contact
</a>
{% endif %}
{% endblock %}

{% block content %}
{% include 'inc/table_controls_htmx.html' with table_modal="ContactTable_config" %}
<form method="post">
{% csrf_token %}
<div class="card">
<div class="card-body" id="object_list">
{% include 'htmx/table.html' %}
</div>
</div>
</form>
{% endblock content %}

{% block modals %}
{{ block.super }}
{% table_config_form table %}
{% endblock modals %}
1 change: 0 additions & 1 deletion netbox/templates/tenancy/tenant.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ <h5 class="card-header">Tenant</h5>
{% include 'inc/panels/custom_fields.html' %}
{% include 'inc/panels/tags.html' %}
{% include 'inc/panels/comments.html' %}
{% include 'inc/panels/contacts.html' %}
{% plugin_left_page object %}
</div>
<div class="col col-md-5">
Expand Down
1 change: 0 additions & 1 deletion netbox/templates/virtualization/cluster.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ <h5 class="card-header">Allocated Resources</h5>
</div>
{% include 'inc/panels/custom_fields.html' %}
{% include 'inc/panels/tags.html' %}
{% include 'inc/panels/contacts.html' %}
{% plugin_right_page object %}
</div>
</div>
Expand Down
1 change: 0 additions & 1 deletion netbox/templates/virtualization/clustergroup.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ <h5 class="card-header">
<div class="col col-md-6">
{% include 'inc/panels/related_objects.html' %}
{% include 'inc/panels/custom_fields.html' %}
{% include 'inc/panels/contacts.html' %}
{% plugin_right_page object %}
</div>
</div>
Expand Down
1 change: 0 additions & 1 deletion netbox/templates/virtualization/virtualmachine.html
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ <h5 class="card-header">Services</h5>
</div>
{% endif %}
</div>
{% include 'inc/panels/contacts.html' %}
{% plugin_right_page object %}
</div>
</div>
Expand Down
Loading