mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-18 08:20:51 +00:00
perf: 优化命令记录慢的问题
This commit is contained in:
@@ -19,7 +19,10 @@ def extract_object_name(exc, index=0):
|
||||
`No User matches the given query.`
|
||||
提取 `User`,`index=1`
|
||||
"""
|
||||
(msg, *_) = exc.args
|
||||
if exc.args:
|
||||
(msg, *others) = exc.args
|
||||
else:
|
||||
return gettext('Object')
|
||||
return gettext(msg.split(sep=' ', maxsplit=index + 1)[index])
|
||||
|
||||
|
||||
|
@@ -97,6 +97,8 @@ class SimpleMetadataWithFilters(SimpleMetadata):
|
||||
fields = view.filterset_fields
|
||||
elif hasattr(view, 'get_filterset_fields'):
|
||||
fields = view.get_filterset_fields(request)
|
||||
elif hasattr(view, 'filterset_class'):
|
||||
fields = view.filterset_class.Meta.fields
|
||||
|
||||
if isinstance(fields, dict):
|
||||
fields = list(fields.keys())
|
||||
|
Reference in New Issue
Block a user