From 6c12d8b402034ab666c3779c790ffde12692ade3 Mon Sep 17 00:00:00 2001 From: Martin Hauser Date: Mon, 13 Apr 2026 17:53:00 +0200 Subject: [PATCH] Fixes #21869: Remove redundant ScriptModule class synchronization on save (#21899) --- netbox/extras/models/scripts.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/netbox/extras/models/scripts.py b/netbox/extras/models/scripts.py index f8c74671a..c20b223e1 100644 --- a/netbox/extras/models/scripts.py +++ b/netbox/extras/models/scripts.py @@ -5,8 +5,6 @@ from functools import cached_property from django.contrib.contenttypes.fields import GenericRelation from django.db import models from django.db.models import Q -from django.db.models.signals import post_save -from django.dispatch import receiver from django.urls import reverse from django.utils.translation import gettext_lazy as _ @@ -188,9 +186,7 @@ class ScriptModule(PythonModuleMixin, JobsMixin, ManagedFile): def save(self, *args, **kwargs): self.file_root = ManagedFileRootPathChoices.SCRIPTS super().save(*args, **kwargs) + + # Sync script classes after the module has been saved. This is the + # single intended synchronization path for ScriptModule saves. self.sync_classes() - - -@receiver(post_save, sender=ScriptModule) -def script_module_post_save_handler(instance, created, **kwargs): - instance.sync_classes()