Skip to content

Commit

Permalink
fix: update set_permissions call in ProjectViewSet.partial_update
Browse files Browse the repository at this point in the history
  • Loading branch information
annehaley committed Oct 1, 2024
1 parent 744e124 commit 99bee91
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions uvdat/core/rest/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ def partial_update(self, request, id):
owner_id = request.data.pop('owner', None)
collaborator_ids = request.data.pop('collaborators', [])
follower_ids = request.data.pop('followers', [])
project.set_permissions(
owner=User.objects.filter(id=owner_id),
collaborator=User.objects.filter(id__in=collaborator_ids),
follower=User.objects.filter(id__in=follower_ids),
)
if owner_id is not None:
project.set_permissions(
owner=User.objects.get(id=owner_id),
collaborator=User.objects.filter(id__in=collaborator_ids),
follower=User.objects.filter(id__in=follower_ids),
)
serializer = ProjectSerializer(project, data=request.data, partial=True)
if serializer.is_valid():
serializer.save()
Expand Down

0 comments on commit 99bee91

Please sign in to comment.