Просмотр исходного кода

Fixes #9843: Fix rendering of custom field values (regression from #9647)

jeremystretch 3 лет назад
Родитель
Сommit
d442f8fd60

+ 1 - 0
docs/release-notes/version-3.3.md

@@ -105,6 +105,7 @@ Custom field UI visibility has no impact on API operation.
 * [#9765](https://github.com/netbox-community/netbox/issues/9765) - Report correct segment count under cable trace UI view
 * [#9794](https://github.com/netbox-community/netbox/issues/9794) - Fix link to connect a rear port to a circuit termination
 * [#9818](https://github.com/netbox-community/netbox/issues/9818) - Fix circuit side selection when connecting a cable to a circuit termination
+* [#9843](https://github.com/netbox-community/netbox/issues/9843) - Fix rendering of custom field values (regression from #9647)
 * [#9844](https://github.com/netbox-community/netbox/issues/9844) - Fix interface api request when creating/editing L2VPN termination
 
 ### Plugins API

+ 10 - 10
netbox/utilities/templates/builtins/customfield_value.html

@@ -1,26 +1,26 @@
-{% if field.type == 'integer' and value is not None %}
+{% if customfield.type == 'integer' and value is not None %}
   {{ value }}
-{% elif field.type == 'longtext' and value %}
+{% elif customfield.type == 'longtext' and value %}
   {{ value|markdown }}
-{% elif field.type == 'boolean' and value == True %}
+{% elif customfield.type == 'boolean' and value == True %}
   {% checkmark value true="True" %}
-{% elif field.type == 'boolean' and value == False %}
+{% elif customfield.type == 'boolean' and value == False %}
   {% checkmark value false="False" %}
-{% elif field.type == 'url' and value %}
+{% elif customfield.type == 'url' and value %}
   <a href="{{ value }}">{{ value|truncatechars:70 }}</a>
-{% elif field.type == 'json' and value %}
+{% elif customfield.type == 'json' and value %}
   <pre>{{ value|json }}</pre>
-{% elif field.type == 'multiselect' and value %}
+{% elif customfield.type == 'multiselect' and value %}
   {{ value|join:", " }}
-{% elif field.type == 'object' and value %}
+{% elif customfield.type == 'object' and value %}
   {{ value|linkify }}
-{% elif field.type == 'multiobject' and value %}
+{% elif customfield.type == 'multiobject' and value %}
   {% for object in value %}
     {{ object|linkify }}{% if not forloop.last %}<br />{% endif %}
   {% endfor %}
 {% elif value %}
   {{ value }}
-{% elif field.required %}
+{% elif customfield.required %}
   <span class="text-warning"><i class="mdi mdi-alert"></i> Not defined</span>
 {% else %}
   {{ ''|placeholder }}