Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes: #18369 - Remove the json filter for protection rules #18388

Merged
merged 3 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions netbox/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,8 +570,9 @@ def get(self, request):
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, None):
setattr(config, attr, json.dumps(getattr(config, attr), cls=ConfigJSONEncoder, indent=4))

return render(request, 'core/system.html', {
'stats': stats,
Expand Down
2 changes: 1 addition & 1 deletion netbox/templates/core/inc/config_data.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
<tr>
<th scope="row" class="border-0 ps-3">{% trans "Protection rules" %}</th>
{% 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>
jeremystretch marked this conversation as resolved.
Show resolved Hide resolved
{% else %}
<td class="border-0">{{ ''|placeholder }}</td>
{% endif %}
Expand Down
Loading