From aab59403e1e26ed9237ced11aeacb2a21ada1c18 Mon Sep 17 00:00:00 2001 From: Bai Date: Mon, 4 Jan 2021 14:32:33 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BF=AE=E6=94=B9=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E6=8E=88=E6=9D=83=E8=A7=84=E5=88=99=E7=9A=84?= =?UTF-8?q?=E5=AD=97=E6=AE=B5(created=5Fby)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/tickets/models/ticket/mixin/base.py | 3 ++- apps/tickets/models/ticket/mixin/meta/apply_application.py | 2 +- apps/tickets/models/ticket/mixin/meta/apply_asset.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/tickets/models/ticket/mixin/base.py b/apps/tickets/models/ticket/mixin/base.py index 373c51e28..5a00d018c 100644 --- a/apps/tickets/models/ticket/mixin/base.py +++ b/apps/tickets/models/ticket/mixin/base.py @@ -100,7 +100,8 @@ class CreatePermissionMixin: # create permission def create_permission(self): create_method = getattr(self, f'create_{self.type}_permission', lambda: None) - create_method() + permission = create_method() + return permission class CreateCommentMixin: diff --git a/apps/tickets/models/ticket/mixin/meta/apply_application.py b/apps/tickets/models/ticket/mixin/meta/apply_application.py index 08eae72d8..56b8c7053 100644 --- a/apps/tickets/models/ticket/mixin/meta/apply_application.py +++ b/apps/tickets/models/ticket/mixin/meta/apply_application.py @@ -120,7 +120,7 @@ class CreatePermissionMixin: 'category': apply_category, 'type': apply_type, 'comment': permission_comment, - 'created_by': self.processor_display, + 'created_by': '{}:{}'.format(str(self.__class__.__name__), str(self.id)), 'date_start': approve_date_start, 'date_expired': approve_date_expired, } diff --git a/apps/tickets/models/ticket/mixin/meta/apply_asset.py b/apps/tickets/models/ticket/mixin/meta/apply_asset.py index 65b9f224e..b24b4b4f7 100644 --- a/apps/tickets/models/ticket/mixin/meta/apply_asset.py +++ b/apps/tickets/models/ticket/mixin/meta/apply_asset.py @@ -121,7 +121,7 @@ class CreatePermissionMixin: 'id': self.id, 'name': permission_name, 'comment': permission_comment, - 'created_by': self.processor_display, + 'created_by': '{}:{}'.format(str(self.__class__.__name__), str(self.id)), 'actions': approve_actions, 'date_start': approve_date_start, 'date_expired': approve_date_expired,