-1
我有一個嚴重的問題..:Django的 - 打破了Mozilla和Chrome瀏覽器不
[06/Jul/2015 14:48:25] "POST /mf HTTP/1.1" 200 26969
Traceback (most recent call last):
File "/usr/lib/python2.7/wsgiref/handlers.py", line 86, in run
self.finish_response()
File "/usr/lib/python2.7/wsgiref/handlers.py", line 128, in finish_response
self.write(data)
File "/usr/lib/python2.7/wsgiref/handlers.py", line 212, in write
self.send_headers()
File "/usr/lib/python2.7/wsgiref/handlers.py", line 270, in send_headers
self.send_preamble()
File "/usr/lib/python2.7/wsgiref/handlers.py", line 194, in send_preamble
'Date: %s\r\n' % format_date_time(time.time())
File "/usr/lib/python2.7/socket.py", line 324, in write
self.flush()
File "/usr/lib/python2.7/socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
[06/Jul/2015 14:48:25] "POST /mf HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 34036)
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 593, in process_request_thread
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/local/lib/python2.7/dist-packages/django/core/servers/basehttp.py", line 129, in __init__
super(WSGIRequestHandler, self).__init__(*args, **kwargs)
File "/usr/lib/python2.7/SocketServer.py", line 651, in __init__
self.finish()
File "/usr/lib/python2.7/SocketServer.py", line 710, in finish
self.wfile.close()
File "/usr/lib/python2.7/socket.py", line 279, in close
self.flush()
File "/usr/lib/python2.7/socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
只有當我使用location.reload()或location.href在我的js方法。實際上,點擊按鈕後,我的js方法獲取表單的元素並將這些元素髮送到我的視圖($ .POST(...))。我的視圖使用這個元素並呈現給html頁面(return render(request,"web_site/mf.html",locals())
)。但是,這使沒有作品...
只在Mozilla的錯誤...
在我的JS方法:
function envoie_post_competences(){
var tab = document.getElementsByName("lesPrec");
$.post("http://localhost:8000/mf",{"lsC[]": tab});
location.href = location.href;
}
我的網址:
...
url(r'^mf$','mf',name="mf"),
...
而我的看法:
def mf(request):
pseudo=request.user.username
i_user = get_object_or_404(User,username=pseudo)
eater = Inscrit.objects.get(user=i_user)
if request.method == "POST":
requete = request.POST
....
return render(request,"le_site/mf.html",locals())
在搜索a解決方案,但在沒有找到...
也許這有用嗎? https://code.djangoproject.com/ticket/4444 – SilverSkin
我不知道code.djangoproject如何工作大聲笑...我搜索... – YassVegas
但我更喜歡手動解決方案,而不是下載一個人的源代碼 – YassVegas