fix AccessPermission form failing with groups

This commit is contained in:
Laura Klünder 2024-12-12 22:43:02 +00:00
parent e41324a4c6
commit 927b388ca8

View file

@ -70,10 +70,10 @@ class AccessPermissionForm(Form):
else: else:
groups = AccessRestrictionGroup.qs_for_user(author) groups = AccessRestrictionGroup.qs_for_user(author)
groups = groups.prefetch_related( groups = groups.prefetch_related(
Prefetch('accessrestrictions', AccessRestriction.objects.only('pk')) Prefetch('members', AccessRestriction.objects.only('pk'))
) )
self.group_contents: dict[int, set[int]] = { self.group_contents: dict[int, set[int]] = {
group.pk: set(r.pk for r in group.accessrestrictions.all()) group.pk: set(r.pk for r in group.members.all())
for group in groups for group in groups
} }
self.group_contents = { self.group_contents = {