mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-04 17:01:09 +00:00
Merge pull request #10826 from jumpserver/pr@dev@perf_account_template
perf: 接口sql优化 /api/v1/accounts/account-templates/su-from-account-templates/
This commit is contained in:
@@ -137,10 +137,10 @@ class AccountTemplate(BaseAccount):
|
||||
]
|
||||
|
||||
@classmethod
|
||||
def get_su_from_account_templates(cls, instance=None):
|
||||
if not instance:
|
||||
def get_su_from_account_templates(cls, pk=None):
|
||||
if pk is None:
|
||||
return cls.objects.all()
|
||||
return cls.objects.exclude(Q(id=instance.id) | Q(su_from=instance))
|
||||
return cls.objects.exclude(Q(id=pk) | Q(_id=pk))
|
||||
|
||||
def get_su_from_account(self, asset):
|
||||
su_from = self.su_from
|
||||
|
Reference in New Issue
Block a user