Skip to content

Commit 8713dd1

Browse files
committed
fixed rules table rendering
1 parent e0c3a9a commit 8713dd1

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

netbox_acls/templates/netbox_acls/accesslist.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ <h5 class="card-header">Access List</h5>
6262
{% elif object.type == 'extended' %}
6363
<td>{{ object.aclextendedrules.count|placeholder }}</td>
6464
{% endif %}
65+
</tr>
6566
<tr>
6667
<th scope="row">Assigned Host</th>
6768
<td>{{ object.assigned_object|linkify }}</td>
6869
</tr>
69-
</tr>
7070
</table>
7171
</div>
7272
</div>
@@ -77,7 +77,8 @@ <h5 class="card-header">Access List</h5>
7777
{% include 'inc/panels/comments.html' %}
7878
</div>
7979
</div>
80-
<div class="row">
80+
{% if rules_table %}
81+
<div class="row">
8182
<div class="col col-md-12">
8283
<div class="card">
8384
<h5 class="card-header">{{ object.get_type_display }} Rules</h5>
@@ -87,4 +88,5 @@ <h5 class="card-header">{{ object.get_type_display }} Rules</h5>
8788
</div>
8889
</div>
8990
</div>
91+
{% endif %}
9092
{% endblock content %}

netbox_acls/views.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,16 @@ def get_extra_context(self, request, instance):
5353
table = tables.ACLExtendedRuleTable(instance.aclextendedrules.all())
5454
elif instance.type == choices.ACLTypeChoices.TYPE_STANDARD:
5555
table = tables.ACLStandardRuleTable(instance.aclstandardrules.all())
56-
table.configure(request)
56+
else:
57+
table = None
5758

58-
return {
59-
"rules_table": table,
60-
}
59+
if table:
60+
table.configure(request)
61+
62+
return {
63+
"rules_table": table,
64+
}
65+
return {}
6166

6267

6368
class AccessListListView(generic.ObjectListView):

0 commit comments

Comments
 (0)