1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00
Files
netbox-community-netbox/netbox/templates/inc/custom_fields_panel.html
Robin Schneider 0ad9b83623 Closes #5503: ISO 8601 date in UI and alternative format as tooltip
With this commit all dates in the UI are now consistently displayed.

I changed the long date format as suggested by @xkilian and confirmed by my own
research.

* DATETIME_FORMAT
 * Before July 20, 2020 4:52 p.m.
 * Now 20th July, 2020 16:52

"20th July, 2020" would be spoken as "the 20th of July, 2020" but the "the" and
"of" are never written.

The only exception is `object_list.html`. I tried it but there it does not
work so easily because the dates are passed to Jinja as SafeString.
2021-07-02 22:22:37 +02:00

37 lines
1.8 KiB
HTML

{% load helpers %}
{% with custom_fields=object.get_custom_fields %}
{% if custom_fields %}
<div class="panel panel-default">
<div class="panel-heading">
<strong>Custom Fields</strong>
</div>
<table class="table table-hover panel-body 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 field.type == 'date' and value %}
{{ value|annotated_date }}
{% 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>
{% endif %}
{% endwith %}