|
|
@@ -25,12 +25,14 @@ from rq.registry import (
|
|
|
from rq.worker import Worker
|
|
|
from rq.worker_registration import clean_worker_registry
|
|
|
|
|
|
+from extras.validators import CustomValidator
|
|
|
from netbox.config import get_config, PARAMS
|
|
|
from netbox.views import generic
|
|
|
from netbox.views.generic.base import BaseObjectView
|
|
|
from netbox.views.generic.mixins import TableMixin
|
|
|
from utilities.forms import ConfirmationForm
|
|
|
from utilities.htmx import htmx_partial
|
|
|
+from utilities.json import ConfigJSONEncoder
|
|
|
from utilities.query import count_related
|
|
|
from utilities.views import ContentTypePermissionRequiredMixin, GetRelatedModelsMixin, register_model_view
|
|
|
from . import filtersets, forms, tables
|
|
|
@@ -572,13 +574,17 @@ class SystemView(UserPassesTestMixin, View):
|
|
|
k: getattr(config, k) for k in sorted(params)
|
|
|
},
|
|
|
}
|
|
|
- response = HttpResponse(json.dumps(data, indent=4), content_type='text/json')
|
|
|
+ response = HttpResponse(json.dumps(data, cls=ConfigJSONEncoder, indent=4), content_type='text/json')
|
|
|
response['Content-Disposition'] = 'attachment; filename="netbox.json"'
|
|
|
return response
|
|
|
|
|
|
plugins_table = tables.PluginTable(plugins, orderable=False)
|
|
|
plugins_table.configure(request)
|
|
|
|
|
|
+ # 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)
|
|
|
+
|
|
|
return render(request, 'core/system.html', {
|
|
|
'stats': stats,
|
|
|
'plugins_table': plugins_table,
|