Пример #1
0
def update_connected(name):
    # {"connected":"True"}
    body = request.get_json()
    ori = Device.objects.get(name=name)
    if (body['connected'] == 'True'):
        ori.update(connected=True)
    elif (body['connected'] == 'False'):
        ori.update(connected=False)

    return Response(Device.objects().get(name=name).to_json(),
                    mimetype="application/json",
                    status=200)
Пример #2
0
def delete_allDevices():
    Device.objects().delete()
    RegisterQueue.objects().delete()
    return Response(Device.objects().to_json(),
                    mimetype="application/json",
                    status=200)
Пример #3
0
def get_devices():
    devices = Device.objects().to_json()
    return Response(devices, mimetype="application/json", status=200)