user_groups: Remove unnecessary select_related.

There is no need for 'select_related("usergroup_ptr")' in queries
for NamedUserGroup table because Django always does a join against
base UserGroup table.
This commit is contained in:
Sahil Batra
2025-09-10 13:02:37 +05:30
committed by Tim Abbott
parent 764f4aa2e0
commit de5a78344a

View File

@@ -939,9 +939,7 @@ def get_root_id_annotated_recursive_subgroups_for_groups(
def get_role_based_system_groups_dict(realm: Realm) -> dict[str, NamedUserGroup]:
system_groups = NamedUserGroup.objects.filter(
realm_for_sharding=realm, is_system_group=True
).select_related("usergroup_ptr")
system_groups = NamedUserGroup.objects.filter(realm_for_sharding=realm, is_system_group=True)
system_groups_name_dict = {}
for group in system_groups:
system_groups_name_dict[group.name] = group