Commit 8225e13b authored by Charlie Jacomme's avatar Charlie Jacomme

[ajaj.py]get_display_info

Permet de récupérer le résultat d'un get_display info et de le passer au js
parent 6dcfecdc
......@@ -40,6 +40,27 @@ def quick_search(request):
response = sock_ou_response
return response
@csrf_exempt
def get_display_info(request):
"""Renvoie l'objet JSON résultat d'un get_display_info
destiné à être chargé par javascript"""
if (request.method == "GET") or (request.session.get("logged", None) != "ok"):
return HttpResponse("Get the fuck out of here", status=444)
else:
try:
asked = json.loads(request.POST["asked"])
except:
return HttpResponse("")
success, sock_ou_response = nk.socket_still_alive(request)
if success:
sock = sock_ou_response
data = asked
sock.write(json.dumps(["get_display_info", data]))
out = nk.full_read(sock)["msg"]
return HttpResponse(json.dumps(out))
else:
HttpResponse("Erreur")
@csrf_exempt
def search(request):
"""Renvoie l'objet JSON résultat d'un search,
......
......@@ -54,6 +54,7 @@ urlpatterns += patterns('note.ajaj',
url(ur'^/quick_search/*$', 'quick_search'),
url(ur'^/search/*$', 'search'),
url(ur'^/get_boutons/*$', 'get_boutons'),
url(ur'^/get_display_info/*$', 'get_display_info'),
url(ur'^/get_photo/(?P<idbde>[^/]*)/*$', 'get_photo'),
url(ur'^/do_conso/*$', 'do_conso'),
url(ur'^/do_(?P<action>credit|retrait)/*$', 'do_credit_retrait'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment