0
django 1.8とdjangorestframeworkで残りのAPIを作成していて、extjs 6.2を使用してクライアント側も作成しています。サーバ 'WSGIRequest'オブジェクトには 'query_params'属性がありませんリクエストは オブジェクトの代わりにWSGIRequestオブジェクトを受け取っていますが、私は今このエラーが発生しています。 )、ここで私のMIDDLEWARE_CLASSESここDjango restframeworkがrest_framework.requestの代わりにWSGIRequestを取得しています。リクエスト
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
'corsheaders.middleware.CorsMiddleware',)
とは、DjangoのビューとExtJSの両方の罰金されている作業しますJAX要求
Djangoのビュー
api_view(["GET"])
def testView(request):
print(request.__class__)
req = json.loads(request.query_params['array'])# here it gives the error
lolo = {"response":"data"}
return JsonResponse(data, safe=False)
ExtJSのAjaxリクエスト
var data = 'insert':{idlineapresupuesto_id:1, idusuario_id:1, nombre:"aaaaaa"}
Ext.Ajax.request({
url :"http://127.0.0.1:8000/editarConcGastosView/?format=json",
method: 'GET',
dataType: 'json',
params: {array: Ext.JSON.encode(data)},
success : function(response){
var jsonResp = Ext.util.JSON.decode(response.responseText);//Guarda en jsonResp la respuesta de la peticion
ありがとうございました! – ghostzero