File tree Expand file tree Collapse file tree 2 files changed +14
-15
lines changed Expand file tree Collapse file tree 2 files changed +14
-15
lines changed Original file line number Diff line number Diff line change 5
5
< h2 class ="card-header "> {% trans "Related Objects" %}</ h2 >
6
6
< ul class ="list-group list-group-flush " role ="presentation ">
7
7
{% 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 "> —</ 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 "> —</ span >
17
+ {% endif %}
18
+ {% endwith %}
19
+ </ a >
20
+ {% endif %}
22
21
{% empty %}
23
22
< span class ="list-group-item text-muted "> {% trans "None" %}</ span >
24
23
{% endfor %}
Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ def sync_button(instance):
164
164
165
165
# TODO: Remove in NetBox v4.7
166
166
@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 ):
168
168
try :
169
169
url = get_action_url (model , action = action )
170
170
except NoReverseMatch :
You can’t perform that action at this time.
0 commit comments