Beispiel #1
0
    def delete(self, request, team_id, region_name):
        try:
            team_services.delete_team_region(team_id, region_name)
        except (Tenants.DoesNotExist, RegionConfig.DoesNotExist, ErrTenantRegionNotFound):
            raise exceptions.NotFound()

        return Response(None, status=status.HTTP_200_OK)
Beispiel #2
0
 def delete(self, request, team_id):
     serializer = TeamRegionReqSerializer(data=request.data)
     serializer.is_valid(raise_exception=True)
     team_data = serializer.data
     region = team_data.get("region", None)
     if region:
         region = region_services.get_region_by_region_name(region)
         if not region:
             raise serializers.ValidationError("指定数据中心不存在")
     code, msg, team = team_services.delete_team_region(team_id, region)
     if code == 200:
         re = TeamBaseInfoSerializer(team)
         return Response(re.data, status=status.HTTP_200_OK)
     else:
         return Response(None, status=status.HTTP_404_NOT_FOUND)