1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

adds related models count on custom field #12825

This commit is contained in:
Abhimanyu Saharan
2023-08-25 19:53:01 +05:30
committed by Jeremy Stretch
parent d79fa131bb
commit 00ebdfe0df
2 changed files with 35 additions and 0 deletions

View File

@@ -134,6 +134,24 @@
</table>
</div>
</div>
<div class="card">
<h5 class="card-header">Related Objects</h5>
<ul class="list-group list-group-flush">
{% for qs in related_models %}
<a class="list-group-item list-group-item-action d-flex justify-content-between">
{{ qs.model|meta:"verbose_name_plural"|bettertitle }}
{% with count=qs.count %}
{% if count %}
<span class="badge bg-primary rounded-pill">{{ count }}</span>
{% else %}
<span class="badge bg-light rounded-pill">&mdash;</span>
{% endif %}
{% endwith %}
</a>
{% endfor %}
</ul>
</div>
{% plugin_right_page object %}
</div>
</div>