Преглед изворни кода

Fixes #7550: Fix rendering of UTF8-encoded data in change records

jeremystretch пре 4 година
родитељ
комит
39430e01de

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

@@ -10,6 +10,7 @@
 * [#7534](https://github.com/netbox-community/netbox/issues/7534) - Avoid exception when utilizing "create and add another" twice in succession
 * [#7534](https://github.com/netbox-community/netbox/issues/7534) - Avoid exception when utilizing "create and add another" twice in succession
 * [#7544](https://github.com/netbox-community/netbox/issues/7544) - Fix multi-value filtering of custom field objects
 * [#7544](https://github.com/netbox-community/netbox/issues/7544) - Fix multi-value filtering of custom field objects
 * [#7545](https://github.com/netbox-community/netbox/issues/7545) - Fix incorrect display of update/delete events for webhooks
 * [#7545](https://github.com/netbox-community/netbox/issues/7545) - Fix incorrect display of update/delete events for webhooks
+* [#7550](https://github.com/netbox-community/netbox/issues/7550) - Fix rendering of UTF8-encoded data in change records
 * [#7556](https://github.com/netbox-community/netbox/issues/7556) - Fix display of version when new release is available
 * [#7556](https://github.com/netbox-community/netbox/issues/7556) - Fix display of version when new release is available
 * [#7584](https://github.com/netbox-community/netbox/issues/7584) - Fix alignment of object identifier under object view
 * [#7584](https://github.com/netbox-community/netbox/issues/7584) - Fix alignment of object identifier under object view
 
 

+ 5 - 5
netbox/templates/extras/objectchange.html

@@ -130,12 +130,12 @@
             </h5>
             </h5>
             <div class="card-body">
             <div class="card-body">
                 {% if object.postchange_data %}
                 {% if object.postchange_data %}
-                <pre class="change-data">{% for k, v in object.postchange_data.items %}{% spaceless %}
-                    <span{% if k in diff_added %} class="added"{% endif %}>{{ k }}: {{ v|render_json }}</span>
-                    {% endspaceless %}{% endfor %}
-                </pre>
+                    <pre class="change-data">{% for k, v in object.postchange_data.items %}{% spaceless %}
+                        <span{% if k in diff_added %} class="added"{% endif %}>{{ k }}: {{ v|render_json }}</span>
+                        {% endspaceless %}{% endfor %}
+                    </pre>
                 {% else %}
                 {% else %}
-                <span class="text-muted">None</span>
+                    <span class="text-muted">None</span>
                 {% endif %}
                 {% endif %}
             </div>
             </div>
         </div>
         </div>

+ 1 - 1
netbox/utilities/templatetags/helpers.py

@@ -58,7 +58,7 @@ def render_json(value):
     """
     """
     Render a dictionary as formatted JSON.
     Render a dictionary as formatted JSON.
     """
     """
-    return json.dumps(value, indent=4, sort_keys=True)
+    return json.dumps(value, ensure_ascii=False, indent=4, sort_keys=True)
 
 
 
 
 @register.filter()
 @register.filter()