14852 delete event-rule when delete script

This commit is contained in:
Arthur
2024-04-29 09:44:02 -07:00
committed by Jeremy Stretch
parent 79b9dc2013
commit 4b21cf604b
2 changed files with 13 additions and 2 deletions
+8
View File
@@ -2,6 +2,7 @@ import inspect
import logging
from functools import cached_property
from django.contrib.contenttypes.fields import GenericRelation
from django.db import models
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
@@ -41,6 +42,13 @@ class ScriptModule(PythonModuleMixin, JobsMixin, ManagedFile):
"""
objects = ScriptModuleManager()
event_rules = GenericRelation(
to='extras.EventRule',
content_type_field='action_object_type',
object_id_field='action_object_id',
for_concrete_model=False
)
class Meta:
proxy = True
verbose_name = _('script module')