GET /buildknowledge/sharing?bid=75&mycheckboxes%5B%5D=16&mycheckboxes%5B%5D=17 HTTP/1.1" 500 14440
我使用POST而不是GET来轻松解释我使用GET请求
views.py
def test(request):
if request.method == "POST" and request.is_ajax() :
if "bid" in request.POST:
B_id=request.POST.get("bid")
sharewith=request.POST.getlist("mycheckboxes")
for user_id in sharewith:
Test(B_id=B_id,sharewith=user_id).save()
return HttpResponse(json.dumps({'msg': "ok"}), content_type="application/json")
else:
return render(request,template_name='registration/basetest.html')
什么都没有保存在数据库中