mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-05 09:21:02 +00:00
fix(assets): 向资产推送系统用户bug
This commit is contained in:
@@ -25,3 +25,16 @@ def get_objects_if_need(model, pks):
|
||||
logger.error(f'DoesNotExist: <{model.__name__}: {not_found_pks}>')
|
||||
return objs
|
||||
return pks
|
||||
|
||||
|
||||
def get_objects(model, pks):
|
||||
if not pks:
|
||||
return pks
|
||||
|
||||
objs = list(model.objects.filter(id__in=pks))
|
||||
if len(objs) != len(pks):
|
||||
pks = set(pks)
|
||||
exists_pks = {o.id for o in objs}
|
||||
not_found_pks = ','.join(pks - exists_pks)
|
||||
logger.error(f'DoesNotExist: <{model.__name__}: {not_found_pks}>')
|
||||
return objs
|
||||
|
Reference in New Issue
Block a user