mirror of
https://github.com/netbox-community/netbox.git
synced 2026-05-06 22:12:43 +08:00
cleanup
This commit is contained in:
@@ -90,8 +90,8 @@ class RenderConfigMixin(ConfigTemplateRenderMixin):
|
||||
# Check for an optional config_template_id override in the request data
|
||||
if config_template_id := request.data.get('config_template_id'):
|
||||
try:
|
||||
configtemplate = ConfigTemplate.objects.get(pk=config_template_id)
|
||||
except ConfigTemplate.DoesNotExist:
|
||||
configtemplate = ConfigTemplate.objects.restrict(request.user, 'view').get(pk=config_template_id)
|
||||
except (ConfigTemplate.DoesNotExist, ValueError):
|
||||
return Response({
|
||||
'error': f'Config template with ID {config_template_id} not found.'
|
||||
}, status=HTTP_400_BAD_REQUEST)
|
||||
|
||||
@@ -1273,7 +1273,7 @@ class ObjectRenderConfigView(generic.ObjectView):
|
||||
error_message = ''
|
||||
if config_template_id := request.GET.get('config_template_id'):
|
||||
try:
|
||||
config_template = ConfigTemplate.objects.get(pk=config_template_id)
|
||||
config_template = ConfigTemplate.objects.restrict(request.user, 'view').get(pk=config_template_id)
|
||||
except (ConfigTemplate.DoesNotExist, ValueError):
|
||||
error_message = _("Config template with ID {id} not found.").format(id=config_template_id)
|
||||
else:
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
{% if error_message %}
|
||||
<div class="alert alert-warning">
|
||||
<h4 class="alert-title mb-1">{% trans "Error rendering template" %}</h4>
|
||||
{% trans error_message %}
|
||||
{{ error_message }}
|
||||
</div>
|
||||
{% elif config_template %}
|
||||
{% if rendered_config %}
|
||||
|
||||
Reference in New Issue
Block a user