Skip to content

Commit ac011e8

Browse files
committed
Merge branch 'fix_dependant_table_view' into 'master'
Fix segment detail view table rendering and typo See merge request 701/netbox/cesnet_service_path_plugin!26
2 parents 0460aae + 020a33a commit ac011e8

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

cesnet_service_path_plugin/templates/cesnet_service_path_plugin/segment.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ <h5 class="card-header">
148148
</div>
149149
</h5>
150150
{% render_table circuits_table 'inc/table.html' %}
151+
{% include 'inc/paginator.html' with paginator=circuits_table.paginator page=circuits_table.page %}
151152
</div>
152153
</div>
153154
</div>
@@ -164,7 +165,8 @@ <h5 class="card-header">
164165
</a>
165166
</div>
166167
</h5>
167-
{% render_table sevice_paths_table 'inc/table.html' %}
168+
{% render_table service_paths_table 'inc/table.html' %}
169+
{% include 'inc/paginator.html' with paginator=service_paths_table.paginator page=service_paths_table.page %}
168170
</div>
169171
</div>
170172
</div>

cesnet_service_path_plugin/views/segment.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,30 @@
88
ServicePath,
99
ServicePathSegmentMapping,
1010
)
11-
from cesnet_service_path_plugin.tables import SegmentTable, ServicePathTable
11+
from cesnet_service_path_plugin.tables import (
12+
SegmentTable,
13+
ServicePathTable,
14+
)
1215

1316

1417
class SegmentView(generic.ObjectView):
1518
queryset = Segment.objects.all()
1619

1720
def get_extra_context(self, request, instance):
1821
circuits = instance.circuits.all()
19-
circuits_table = CircuitTable(circuits, exclude=())
22+
circuits_table = CircuitTable(circuits)
23+
circuits_table.configure(request)
2024

21-
related_service_paths_ids = ServicePathSegmentMapping.objects.filter(segment=instance).values_list(
22-
"service_path_id", flat=True
23-
)
25+
related_service_paths_ids = ServicePathSegmentMapping.objects.filter(
26+
segment=instance
27+
).values_list("service_path_id", flat=True)
2428
service_paths = ServicePath.objects.filter(id__in=related_service_paths_ids)
25-
service_paths_table = ServicePathTable(service_paths, exclude=())
29+
service_paths_table = ServicePathTable(service_paths)
30+
service_paths_table.configure(request)
31+
2632
return {
2733
"circuits_table": circuits_table,
28-
"sevice_paths_table": service_paths_table,
34+
"service_paths_table": service_paths_table,
2935
}
3036

3137

0 commit comments

Comments
 (0)