Skip to content

Commit

Permalink
explitictly unset prioritize on deprioritizing
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-boute committed Dec 13, 2023
1 parent eea7899 commit 9864a5c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion website/orders/api/v1/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ def update(self, request, *args, **kwargs):
if instance.deprioritize and not deprioritize:
self.permission_denied(request, message="Deprioritize can not be unset.", code=400)
else:
serializer = self.get_serializer(instance, data={"deprioritize": deprioritize}, partial=True)
data = {"deprioritize": True, "prioritize": False} if deprioritize else {"deprioritize": False}
serializer = self.get_serializer(instance, data=data, partial=True)
serializer.is_valid(raise_exception=True)
self.perform_update(serializer)
return Response(serializer.data)
Expand Down

0 comments on commit 9864a5c

Please sign in to comment.