1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00
netbox-community-netbox/netbox/templates/inc/custom_fields_panel.html
Robin Schneider a479c867c4 Do not use annotated_date on custom date fields to avoid date parsing
@jeremystretch:

> It'd be better to have the custom field return a date object than to
> accommodate string values in the template filter. Let's just omit custom
> field dates for now to keep this from getting any more complex.
2021-07-02 22:30:11 +02:00

36 lines
1.7 KiB
HTML

{% with custom_fields=object.get_custom_fields %}
{% if custom_fields %}
<div class="card">
<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 }}">{{ field }}</span></td>
<td>
{% if field.type == 'boolean' and value == True %}
<i class="mdi mdi-check-bold text-success" title="True"></i>
{% elif field.type == 'boolean' and value == False %}
<i class="mdi mdi-close-thick text-danger" title="False"></i>
{% elif field.type == 'url' and value %}
<a href="{{ value }}">{{ value|truncatechars:70 }}</a>
{% elif field.type == 'multiselect' and value %}
{{ value|join:", " }}
{% elif value is not None %}
{{ value }}
{% elif field.required %}
<span class="text-warning">Not defined</span>
{% else %}
<span class="text-muted">&mdash;</span>
{% endif %}
</td>
</tr>
{% endfor %}
</table>
</div>
</div>
{% endif %}
{% endwith %}