From f81b0a7dab987ce536ad35469a5075e4b9dc1468 Mon Sep 17 00:00:00 2001 From: atownson <52260120+atownson@users.noreply.github.com> Date: Fri, 17 Jan 2025 12:07:05 -0600 Subject: [PATCH] Configure PROTECTION_RULE config attribute to use ConfigJSONEncoder as serializer --- netbox/core/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/netbox/core/views.py b/netbox/core/views.py index 713807a82..ee35be541 100644 --- a/netbox/core/views.py +++ b/netbox/core/views.py @@ -570,8 +570,9 @@ class SystemView(UserPassesTestMixin, View): return response # Serialize any CustomValidator classes - if hasattr(config, 'CUSTOM_VALIDATORS') and config.CUSTOM_VALIDATORS: - config.CUSTOM_VALIDATORS = json.dumps(config.CUSTOM_VALIDATORS, cls=ConfigJSONEncoder, indent=4) + for attr in ['CUSTOM_VALIDATORS', 'PROTECTION_RULES']: + if hasattr(config, attr) and getattr(config, attr): + setattr(config, attr, json.dumps(getattr(config, attr), cls=ConfigJSONEncoder, indent=4)) return render(request, 'core/system.html', { 'stats': stats,