[WEB - 1213] fix: module webhook (#4385)

* dev: fix module webhook

* dev: correct the comment

* dev: handle does not exist exception
This commit is contained in:
Nikhil 2024-05-07 15:51:08 +05:30 committed by GitHub
parent 967ad77078
commit a40517015b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 25 additions and 19 deletions

View file

@ -431,15 +431,15 @@ class ModuleViewSet(BaseViewSet):
def partial_update(self, request, slug, project_id, pk):
module = self.get_queryset().filter(pk=pk)
current_instance = json.dumps(
ModuleSerializer(module).data, cls=DjangoJSONEncoder
)
if module.first().archived_at:
return Response(
{"error": "Archived module cannot be updated"},
status=status.HTTP_400_BAD_REQUEST,
)
current_instance = json.dumps(
ModuleSerializer(module.first()).data, cls=DjangoJSONEncoder
)
serializer = ModuleWriteSerializer(
module.first(), data=request.data, partial=True
)