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

Extend to support the assignment of multiple objects per field

This commit is contained in:
jeremystretch
2022-01-05 17:05:54 -05:00
parent 954d81147e
commit 271b7adeb8
5 changed files with 82 additions and 10 deletions

View File

@ -3,14 +3,14 @@
{% with custom_fields=object.get_custom_fields %}
{% if custom_fields %}
<div class="card">
<h5 class="card-header">
Custom Fields
</h5>
<h5 class="card-header">Custom Fields</h5>
<div class="card-body">
<table class="table table-hover attr-table">
{% for field, value in custom_fields.items %}
<tr>
<td><span title="{{ field.description|escape }}">{{ field }}</span></td>
<td>
<span title="{{ field.description|escape }}">{{ field }}</span>
</td>
<td>
{% if field.type == 'longtext' and value %}
{{ value|render_markdown }}
@ -26,6 +26,14 @@
{{ value|join:", " }}
{% elif field.type == 'object' and value %}
<a href="{{ value.get_absolute_url }}">{{ value }}</a>
{% elif field.type == 'multiobject' and value %}
{% if value %}
<ul>
{% for obj in value %}
<li><a href="{{ obj.get_absolute_url }}">{{ obj }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% elif value is not None %}
{{ value }}
{% elif field.required %}