mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 04:22:01 -06:00
* Remove the json filter for protection rules * Configure PROTECTION_RULE config attribute to use ConfigJSONEncoder as serializer * Tweak getattr() --------- Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
This commit is contained in:
parent
5b9210dfa5
commit
2ed4a2b005
@ -570,8 +570,9 @@ class SystemView(UserPassesTestMixin, View):
|
|||||||
return response
|
return response
|
||||||
|
|
||||||
# Serialize any CustomValidator classes
|
# Serialize any CustomValidator classes
|
||||||
if hasattr(config, 'CUSTOM_VALIDATORS') and config.CUSTOM_VALIDATORS:
|
for attr in ['CUSTOM_VALIDATORS', 'PROTECTION_RULES']:
|
||||||
config.CUSTOM_VALIDATORS = json.dumps(config.CUSTOM_VALIDATORS, cls=ConfigJSONEncoder, indent=4)
|
if hasattr(config, attr) and getattr(config, attr, None):
|
||||||
|
setattr(config, attr, json.dumps(getattr(config, attr), cls=ConfigJSONEncoder, indent=4))
|
||||||
|
|
||||||
return render(request, 'core/system.html', {
|
return render(request, 'core/system.html', {
|
||||||
'stats': stats,
|
'stats': stats,
|
||||||
|
@ -103,7 +103,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th scope="row" class="border-0 ps-3">{% trans "Protection rules" %}</th>
|
<th scope="row" class="border-0 ps-3">{% trans "Protection rules" %}</th>
|
||||||
{% if config.PROTECTION_RULES %}
|
{% if config.PROTECTION_RULES %}
|
||||||
<td class="border-0"><pre>{{ config.PROTECTION_RULES|json }}</pre></td>
|
<td class="border-0"><pre>{{ config.PROTECTION_RULES }}</pre></td>
|
||||||
{% else %}
|
{% else %}
|
||||||
<td class="border-0">{{ ''|placeholder }}</td>
|
<td class="border-0">{{ ''|placeholder }}</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Loading…
Reference in New Issue
Block a user