1 from django.shortcuts import render
2 from django.http import HttpResponse, HttpRequest
9 from django.views.decorators.csrf import csrf_exempt
12 dir_list = os.listdir("logs/")
13 connection = sqlite3.connect("logs/"+dir_list[0])
14 #connection.row_factory = lambda cursor, row: row[0]
15 cursor = connection.cursor()
16 rows = cursor.execute(query).fetchall()
20 def index(request,devicename):
21 dev=list(load_db("select cast(device as text) from devices where devkey = \""+devicename+"\""))
23 #dev_string = "{ \"recordsTotal\": "+str(dev_count)+", \"data\": ["
24 #dev_list = list(load_db("select cast(device as text) from devices limit 50"))
25 #for device in dev_list:
27 # dev_string = dev_string + dev + ","
28 #dev_string = dev_string[:-1]
29 #dev_string = dev_string + "],\"draw\": 5,\"recordsFiltered\": "+str(dev_count)+"}"
30 return HttpResponse(dev_info, content_type='text/json')