这是我的角度代码
Upload.upload({
url: '/designer/profile/projects_info/',
file: files,
fields: {projectInfo: $scope.projectInfo},
}).progress(function (evt) {
var progressPercentage = parseInt(100.0 * evt.loaded / evt.total);
// $scope.log = 'progress: ' + progressPercentage + '% ' + evt.config.file.name + '\n' + $scope.log;
}).success(function (data, status, headers, config) {
console.log(data);
$scope.projectUuid = data.projectUuid;
$scope.projectPicIdsList = [];
$scope.projectPicIdsList = data.projectPicIdsList;
// $timeout(function() {
// $scope.log = 'file: ' + config.file.name + ', Response: ' + JSON.stringify(data) + '\n' + $scope.log;
// });
});
我想在上传功能中发送我的字段
fields: {projectInfo: $scope.projectInfo}
但它不是以json格式发送的。
以上代码的输出是
{u'projectInfo': [u'{"projectName":"abc","projectType":["xyz","abc"],"location":"pqr","projectDescription":"abcxyz"}']}>
但我希望这些json格式的对象不是字符串。
我的django视图
def save_designer_projects_info(request):
print request.POST