def delete(request: HttpRequest): if request.method != CommonData.Method.GET.value: return HttpResponse(Response.methodInvalidResponse().toJson(), content_type='application/json') project_id = request.GET['project_id'] if project_id is None: response = Response(RequestParamsError, 'Project_id is None', {}) return HttpResponse(response.toJson(), content_type='application/json') success = ProjectDao.delete(project_id) if success: return HttpResponse(Response.successResponse().toJson(), content_type='application/json') else: return HttpResponse(Response.daoOperationErrorResponse().toJson(), content_type='application/json')
def delete(request): if request.method != CommonData.Method.GET.value: data = CommonData.response_data(RequetMethodError, "Method is invalid") return HttpResponse(json.dumps(data), content_type="application/json") project_id = request.GET['project_id'] if project_id is None: data = CommonData.response_data(RequetParamsError, "project_id is None") return HttpResponse(json.dumps(data), content_type="application/json") succesed = ProjectDao.delete(project_id) if succesed: data = CommonData.response_data(Success, "Success") return HttpResponse(json.dumps(data), content_type="application/json") else: data = CommonData.response_data(DaoOperationError, "Delete Failed") return HttpResponse(json.dumps(data), content_type="application/json")