Skip to content

Commit 109c85f

Browse files
committed
20190 review feedback
1 parent 26fb733 commit 109c85f

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

netbox/templates/inc/panels/related_objects.html

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,19 @@
55
<h2 class="card-header">{% trans "Related Objects" %}</h2>
66
<ul class="list-group list-group-flush" role="presentation">
77
{% for related_object_count in related_models %}
8-
{% with viewname=related_object_count.queryset.model|validated_viewname:"list" %}
9-
{% if viewname is not None %}
10-
<a href="{% url viewname %}?{{ related_object_count.filter_param }}={{ object.pk }}" class="list-group-item list-group-item-action d-flex justify-content-between">
11-
{{ related_object_count.name }}
12-
{% with count=related_object_count.queryset.count %}
13-
{% if count %}
14-
<span class="badge text-bg-primary rounded-pill">{{ count }}</span>
15-
{% else %}
16-
<span class="badge text-bg-light rounded-pill">&mdash;</span>
17-
{% endif %}
18-
{% endwith %}
19-
</a>
20-
{% endif %}
21-
{% endwith %}
8+
{% action_url qs.model 'list' as list_url %}
9+
{% if list_url %}
10+
<a href="{{ list_url }}?{{ related_object_count.filter_param }}={{ object.pk }}" class="list-group-item list-group-item-action d-flex justify-content-between">
11+
{{ related_object_count.name }}
12+
{% with count=related_object_count.queryset.count %}
13+
{% if count %}
14+
<span class="badge text-bg-primary rounded-pill">{{ count }}</span>
15+
{% else %}
16+
<span class="badge text-bg-light rounded-pill">&mdash;</span>
17+
{% endif %}
18+
{% endwith %}
19+
</a>
20+
{% endif %}
2221
{% empty %}
2322
<span class="list-group-item text-muted">{% trans "None" %}</span>
2423
{% endfor %}

netbox/utilities/templatetags/buttons.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def sync_button(instance):
164164

165165
# TODO: Remove in NetBox v4.7
166166
@register.inclusion_tag('buttons/add.html')
167-
def add_button(model, return_url=None, action='add'):
167+
def add_button(model, action='add', return_url=None):
168168
try:
169169
url = get_action_url(model, action=action)
170170
except NoReverseMatch:

0 commit comments

Comments
 (0)