|
4 | 4 | import django_rq |
5 | 5 | from django.conf import settings |
6 | 6 | from django.contrib import messages |
| 7 | +from django.contrib.contenttypes.models import ContentType |
7 | 8 | from django.http import HttpResponse |
8 | 9 | from django.shortcuts import redirect, render |
9 | 10 | from django.views.generic import View |
|
17 | 18 | from . import filtersets, forms, models, tables, util |
18 | 19 | from .api.serializers import ScriptLogLineMinimalSerializer |
19 | 20 | from .choices import ScriptExecutionStatusChoices |
| 21 | +from .models import ScriptExecution |
20 | 22 | from .scripts import run_script |
21 | 23 |
|
22 | 24 | plugin_config = settings.PLUGINS_CONFIG.get("netbox_script_manager") |
@@ -200,14 +202,14 @@ class ScriptExecutionObjectChangeView(generic.ObjectChildrenView): |
200 | 202 | template_name = "netbox_script_manager/script_execution_objectchange_list.html" |
201 | 203 | tab = ViewTab( |
202 | 204 | label="Changes", |
203 | | - badge=lambda obj: ObjectChange.objects.filter(request_id=str(obj.request_id)).count(), |
| 205 | + badge=lambda obj: ObjectChange.objects.filter(request_id=str(obj.request_id)).exclude(changed_object_type=ContentType.objects.get_for_model(ScriptExecution)).count(), |
204 | 206 | permission="netbox_script_manager.view_scriptexecution", |
205 | 207 | weight=500, |
206 | 208 | hide_if_empty=False, |
207 | 209 | ) |
208 | 210 |
|
209 | 211 | def get_children(self, request, parent): |
210 | | - return ObjectChange.objects.restrict(request.user, "view").filter(request_id=str(parent.request_id)) |
| 212 | + return ObjectChange.objects.restrict(request.user, "view").filter(request_id=str(parent.request_id)).exclude(changed_object_type=ContentType.objects.get_for_model(ScriptExecution)) |
211 | 213 |
|
212 | 214 |
|
213 | 215 | @register_model_view(models.ScriptExecution, "data") |
|
0 commit comments