diff --git a/program/views.py b/program/views.py index 237edb3ab87d00ef7050c082edd4b2a3a74b9b02..ba5d807a89543b3d5e8a9842195561b7a4e77088 100644 --- a/program/views.py +++ b/program/views.py @@ -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."),