From 709b676ec7ecb0dc42ba3a4f6164c1e7d2dcd3ec Mon Sep 17 00:00:00 2001 From: feng <1304903146@qq.com> Date: Fri, 6 Dec 2024 17:56:10 +0800 Subject: [PATCH] perf: Automation filter org --- apps/assets/models/automations/base.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/assets/models/automations/base.py b/apps/assets/models/automations/base.py index 4e2eb39e6..3c235ea9d 100644 --- a/apps/assets/models/automations/base.py +++ b/apps/assets/models/automations/base.py @@ -10,10 +10,14 @@ from assets.tasks import execute_asset_automation_task from common.const.choices import Trigger, Status from common.db.fields import EncryptJsonDictTextField from ops.mixin import PeriodTaskModelMixin -from orgs.mixins.models import OrgModelMixin, JMSOrgBaseModel +from orgs.mixins.models import OrgModelMixin, JMSOrgBaseModel, OrgManager from users.models import User +class BaseAutomationManager(OrgManager): + pass + + class BaseAutomation(PeriodTaskModelMixin, JMSOrgBaseModel): accounts = models.JSONField(default=list, verbose_name=_("Accounts")) nodes = models.ManyToManyField("assets.Node", blank=True, verbose_name=_("Node")) @@ -24,6 +28,8 @@ class BaseAutomation(PeriodTaskModelMixin, JMSOrgBaseModel): is_active = models.BooleanField(default=True, verbose_name=_("Is active")) params = models.JSONField(default=dict, verbose_name=_("Parameters")) + objects = BaseAutomationManager.from_queryset(models.QuerySet)() + def get_report_template(self): raise NotImplementedError