Back to Netbox

Customfield Value

netbox/utilities/templates/builtins/customfield_value.html

4.6.41.5 KB
Original Source

{% load helpers %} {% load i18n %} {% if customfield.type == 'integer' and value is not None %} {{ value }} {% elif customfield.type == 'decimal' and value is not None %} {{ value }} {% elif customfield.type == 'longtext' and value %} {{ value|markdown }} {% elif customfield.type == 'boolean' and value == True %} {% checkmark value true="True" %} {% elif customfield.type == 'boolean' and value == False %} {% checkmark value false="False" %} {% elif customfield.type == 'date' and value %} {{ value|isodate }} {% elif customfield.type == 'datetime' and value %} {{ value|isodatetime }} {% elif customfield.type == 'url' and value %} {{ value|truncatechars:70 }} {% elif customfield.type == 'json' and value is not None %}

{{ value|json }}

{% elif customfield.type == 'select' and value %} {% if color %} {% badge value bg_color=color %} {% else %} {{ value }} {% endif %} {% elif customfield.type == 'multiselect' and value %} {% if value_has_colors %} {% for choice_label, choice_color in value %} {% if choice_color %} {% badge choice_label bg_color=choice_color %} {% else %} {% badge choice_label %} {% endif %} {% endfor %} {% else %} {{ value|join:", " }} {% endif %} {% elif customfield.type == 'object' and value %} {{ value|linkify }} {% elif customfield.type == 'multiobject' and value %} {% for object in value %} {{ object|linkify }}{% if not forloop.last %}
{% endif %} {% endfor %} {% elif value %} {{ value }} {% elif customfield.required %} {% trans "Not defined" %} {% else %} {{ ''|placeholder }} {% endif %}