From 743c9bc3f1edbec444bac6c3c99f1cd1201c62f7 Mon Sep 17 00:00:00 2001 From: feng626 <1304903146@qq.com> Date: Thu, 16 Sep 2021 19:28:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=BF=87=E6=BB=A4=E5=85=B6=E5=AE=83?= =?UTF-8?q?=E7=B1=BB=E5=9E=8Bapp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ticket/meta/ticket_type/apply_application.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/tickets/serializers/ticket/meta/ticket_type/apply_application.py b/apps/tickets/serializers/ticket/meta/ticket_type/apply_application.py index 8ea1075d2..46ef5386d 100644 --- a/apps/tickets/serializers/ticket/meta/ticket_type/apply_application.py +++ b/apps/tickets/serializers/ticket/meta/ticket_type/apply_application.py @@ -6,6 +6,8 @@ from perms.models import ApplicationPermission from applications.const import AppCategory, AppType from orgs.utils import tmp_to_org from tickets.models import Ticket +from applications.models import Application +from assets.models import SystemUser from .common import DefaultPermissionName __all__ = [ @@ -71,6 +73,13 @@ class ApplySerializer(serializers.Serializer): 'Permission named `{}` already exists'.format(permission_name) )) + def validate_apply_applications(self, apply_applications): + type = self.root.initial_data['meta'].get('apply_type') + org_id = self.root.initial_data.get('org_id') + with tmp_to_org(org_id): + applications = Application.objects.filter(id__in=apply_applications, type=type).values_list('id', flat=True) + return list(applications) + def validate_apply_date_expired(self, value): date_start = self.root.initial_data['meta'].get('apply_date_start') date_start = datetime.strptime(date_start, '%Y-%m-%dT%H:%M:%S.%fZ')