Skip to content
Snippets Groups Projects
Verified Commit 6fe835bb authored by Ernesto Rico Schmidt's avatar Ernesto Rico Schmidt
Browse files

feat: deactivate instead of delete a link type

parent 7b76a9c4
No related branches found
No related tags found
No related merge requests found
......@@ -886,6 +886,17 @@ class APILinkTypeViewSet(viewsets.ModelViewSet):
queryset = LinkType.objects.all()
serializer_class = LinkTypeSerializer
def destroy(self, request, *args, **kwargs):
"""Destroying a link type just makes is inactive.
This is needed to preserve all the links that reference a link type."""
link_type = self.get_object()
link_type.is_active = False
link_type.save()
return Response(status=status.HTTP_204_NO_CONTENT)
@extend_schema_view(
create=extend_schema(summary="Create a new license type."),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment