mirror of
https://github.com/Steffo99/sophon.git
synced 2024-12-23 07:14:21 +00:00
🐛 Return responses instead of raising exceptions
This commit is contained in:
parent
0e4cccc57a
commit
54dbb35724
1 changed files with 2 additions and 2 deletions
|
@ -234,11 +234,11 @@ class ResearchGroupViewSet(WriteSophonViewSet):
|
||||||
|
|
||||||
# Raise an error if the user is not in the group
|
# Raise an error if the user is not in the group
|
||||||
if self.request.user not in group.members.all():
|
if self.request.user not in group.members.all():
|
||||||
raise HTTPException(s.HTTP_409_CONFLICT)
|
return Response(status=s.HTTP_409_CONFLICT)
|
||||||
|
|
||||||
# Raise an error if the user is the owner of the group
|
# Raise an error if the user is the owner of the group
|
||||||
if self.request.user == group.owner:
|
if self.request.user == group.owner:
|
||||||
raise HTTPException(s.HTTP_403_FORBIDDEN)
|
return Response(status=s.HTTP_403_FORBIDDEN)
|
||||||
|
|
||||||
# Add the user to the group
|
# Add the user to the group
|
||||||
group.members.remove(self.request.user)
|
group.members.remove(self.request.user)
|
||||||
|
|
Loading…
Reference in a new issue