mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Use prefetch to improve query efficiency (#5613)
- Significantly improves performance of users.models.update_group_roles() function - Ref: https://github.com/inventree/InvenTree/pull/5612
This commit is contained in:
parent
b69342a3d2
commit
200bc5bd3d
@ -376,7 +376,7 @@ def update_group_roles(group, debug=False):
|
||||
|
||||
# Iterate through each permission already assigned to this group,
|
||||
# and create a simplified permission key string
|
||||
for p in group.permissions.all():
|
||||
for p in group.permissions.all().prefetch_related('content_type'):
|
||||
(permission, app, model) = p.natural_key()
|
||||
|
||||
permission_string = '{app}.{perm}'.format(
|
||||
|
Loading…
Reference in New Issue
Block a user