Răsfoiți Sursa

Improve rendering of JSON data

Jeremy Stretch 2 ani în urmă
părinte
comite
e4824db40b
1 a modificat fișierele cu 21 adăugiri și 3 ștergeri
  1. 21 3
      netbox/templates/core/configrevision.html

+ 21 - 3
netbox/templates/core/configrevision.html

@@ -149,11 +149,23 @@
           <table class="table table-hover attr-table">
           <table class="table table-hover attr-table">
             <tr>
             <tr>
               <th scope="row">{% trans "Custom validators" %}</th>
               <th scope="row">{% trans "Custom validators" %}</th>
-              <td>{{ object.data.CUSTOM_VALIDATORS|placeholder }}</td>
+              {% if object.data.CUSTOM_VALIDATORS %}
+                <td class="font-monospace">
+                  <pre>{{ object.data.CUSTOM_VALIDATORS|json }}</pre>
+                </td>
+              {% else %}
+                <td>{{ ''|placeholder }}</td>
+              {% endif %}
             </tr>
             </tr>
             <tr>
             <tr>
               <th scope="row">{% trans "Protection rules" %}</th>
               <th scope="row">{% trans "Protection rules" %}</th>
-              <td>{{ object.data.PROTECTION_RULES|placeholder }}</td>
+              {% if object.data.PROTECTION_RULES %}
+                <td>
+                  <pre>{{ object.data.PROTECTION_RULES|json }}</pre>
+                </td>
+              {% else %}
+                <td>{{ ''|placeholder }}</td>
+              {% endif %}
             </tr>
             </tr>
           </table>
           </table>
         </div>
         </div>
@@ -165,7 +177,13 @@
           <table class="table table-hover attr-table">
           <table class="table table-hover attr-table">
             <tr>
             <tr>
               <th scope="row">{% trans "Default user preferences" %}</th>
               <th scope="row">{% trans "Default user preferences" %}</th>
-              <td>{{ object.data.DEFAULT_USER_PREFERENCES|placeholder }}</td>
+              {% if object.data.DEFAULT_USER_PREFERENCES %}
+                <td>
+                  <pre>{{ object.data.DEFAULT_USER_PREFERENCES|json }}</pre>
+                </td>
+              {% else %}
+                <td>{{ ''|placeholder }}</td>
+              {% endif %}
             </tr>
             </tr>
           </table>
           </table>
         </div>
         </div>