Skip to content

Commit e002b61

Browse files
committed
Use embedded tables for importing/export VRFs & L2VPNs under route target view
1 parent f6b448d commit e002b61

File tree

2 files changed

+41
-20
lines changed

2 files changed

+41
-20
lines changed

netbox/ipam/views.py

-15
Original file line numberDiff line numberDiff line change
@@ -103,21 +103,6 @@ class RouteTargetListView(generic.ObjectListView):
103103
class RouteTargetView(generic.ObjectView):
104104
queryset = RouteTarget.objects.all()
105105

106-
def get_extra_context(self, request, instance):
107-
importing_vrfs_table = tables.VRFTable(
108-
instance.importing_vrfs.all(),
109-
orderable=False
110-
)
111-
exporting_vrfs_table = tables.VRFTable(
112-
instance.exporting_vrfs.all(),
113-
orderable=False
114-
)
115-
116-
return {
117-
'importing_vrfs_table': importing_vrfs_table,
118-
'exporting_vrfs_table': exporting_vrfs_table,
119-
}
120-
121106

122107
@register_model_view(RouteTarget, 'edit')
123108
class RouteTargetEditView(generic.ObjectEditView):

netbox/templates/ipam/routetarget.html

+41-5
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,52 @@ <h5 class="card-header">Route Target</h5>
2525
</div>
2626
</div>
2727
{% include 'inc/panels/tags.html' %}
28+
{% plugin_left_page object %}
29+
</div>
30+
<div class="col col-md-6">
2831
{% include 'inc/panels/custom_fields.html' %}
2932
{% include 'inc/panels/comments.html' %}
30-
{% plugin_left_page object %}
33+
{% plugin_right_page object %}
3134
</div>
35+
</div>
36+
<div class="row mb-3">
3237
<div class="col col-md-6">
33-
<div class="mb-4">
34-
{% include 'inc/panel_table.html' with table=importing_vrfs_table heading="Importing VRFs" %}
38+
<div class="card">
39+
<h5 class="card-header">Importing VRFs</h5>
40+
<div class="card-body htmx-container table-responsive"
41+
hx-get="{% url 'ipam:vrf_list' %}?import_target_id={{ object.pk }}"
42+
hx-trigger="load"
43+
></div>
44+
</div>
45+
</div>
46+
<div class="col col-md-6">
47+
<div class="card">
48+
<h5 class="card-header">Exporting VRFs</h5>
49+
<div class="card-body htmx-container table-responsive"
50+
hx-get="{% url 'ipam:vrf_list' %}?export_target_id={{ object.pk }}"
51+
hx-trigger="load"
52+
></div>
53+
</div>
54+
</div>
55+
</div>
56+
<div class="row mb-3">
57+
<div class="col col-md-6">
58+
<div class="card">
59+
<h5 class="card-header">Importing L2VPNs</h5>
60+
<div class="card-body htmx-container table-responsive"
61+
hx-get="{% url 'ipam:l2vpn_list' %}?import_target_id={{ object.pk }}"
62+
hx-trigger="load"
63+
></div>
64+
</div>
65+
</div>
66+
<div class="col col-md-6">
67+
<div class="card">
68+
<h5 class="card-header">Exporting L2VPNs</h5>
69+
<div class="card-body htmx-container table-responsive"
70+
hx-get="{% url 'ipam:l2vpn_list' %}?export_target_id={{ object.pk }}"
71+
hx-trigger="load"
72+
></div>
3573
</div>
36-
{% include 'inc/panel_table.html' with table=exporting_vrfs_table heading="Exporting VRFs" %}
37-
{% plugin_right_page object %}
3874
</div>
3975
</div>
4076
<div class="row">

0 commit comments

Comments
 (0)