20190 review feedback

This commit is contained in:
Arthur 2025-08-29 14:11:07 -07:00
parent 26fb733b3a
commit 109c85f764
2 changed files with 14 additions and 15 deletions

View File

@ -5,20 +5,19 @@
<h2 class="card-header">{% trans "Related Objects" %}</h2> <h2 class="card-header">{% trans "Related Objects" %}</h2>
<ul class="list-group list-group-flush" role="presentation"> <ul class="list-group list-group-flush" role="presentation">
{% for related_object_count in related_models %} {% for related_object_count in related_models %}
{% with viewname=related_object_count.queryset.model|validated_viewname:"list" %} {% action_url qs.model 'list' as list_url %}
{% if viewname is not None %} {% if list_url %}
<a href="{% url viewname %}?{{ related_object_count.filter_param }}={{ object.pk }}" class="list-group-item list-group-item-action d-flex justify-content-between"> <a href="{{ list_url }}?{{ related_object_count.filter_param }}={{ object.pk }}" class="list-group-item list-group-item-action d-flex justify-content-between">
{{ related_object_count.name }} {{ related_object_count.name }}
{% with count=related_object_count.queryset.count %} {% with count=related_object_count.queryset.count %}
{% if count %} {% if count %}
<span class="badge text-bg-primary rounded-pill">{{ count }}</span> <span class="badge text-bg-primary rounded-pill">{{ count }}</span>
{% else %} {% else %}
<span class="badge text-bg-light rounded-pill">&mdash;</span> <span class="badge text-bg-light rounded-pill">&mdash;</span>
{% endif %} {% endif %}
{% endwith %} {% endwith %}
</a> </a>
{% endif %} {% endif %}
{% endwith %}
{% empty %} {% empty %}
<span class="list-group-item text-muted">{% trans "None" %}</span> <span class="list-group-item text-muted">{% trans "None" %}</span>
{% endfor %} {% endfor %}

View File

@ -164,7 +164,7 @@ def sync_button(instance):
# TODO: Remove in NetBox v4.7 # TODO: Remove in NetBox v4.7
@register.inclusion_tag('buttons/add.html') @register.inclusion_tag('buttons/add.html')
def add_button(model, return_url=None, action='add'): def add_button(model, action='add', return_url=None):
try: try:
url = get_action_url(model, action=action) url = get_action_url(model, action=action)
except NoReverseMatch: except NoReverseMatch: