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

Fixes #11483: Apply configured formatting to custom date fields

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

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

@@ -23,6 +23,7 @@
 * [#11438](https://github.com/netbox-community/netbox/issues/11438) - Fix deletion of scheduled job using non-default queues
 * [#11444](https://github.com/netbox-community/netbox/issues/11444) - Adding/removing a device from a device bay should record a pre-change snapshot on the device bay
 * [#11467](https://github.com/netbox-community/netbox/issues/11467) - Correct count on interfaces tab when viewing a VC master device
+* [#11483](https://github.com/netbox-community/netbox/issues/11483) - Apply configured formatting to custom date fields
 
 ---
 

+ 3 - 0
netbox/utilities/templates/builtins/customfield_value.html

@@ -1,3 +1,4 @@
+{% load helpers %}
 {% if customfield.type == 'integer' and value is not None %}
   {{ value }}
 {% elif customfield.type == 'longtext' and value %}
@@ -6,6 +7,8 @@
   {% checkmark value true="True" %}
 {% elif customfield.type == 'boolean' and value == False %}
   {% checkmark value false="False" %}
+{% elif customfield.type == 'date' and value %}
+  {{ value|annotated_date }}
 {% elif customfield.type == 'url' and value %}
   <a href="{{ value }}">{{ value|truncatechars:70 }}</a>
 {% elif customfield.type == 'json' and value %}