Ejemplo n.º 1
0
def model_action(request, model_class, method):
    response = simple_api.send_response(status='error', data='Unknown method %s' % method)
    for model in simple_api.dispatcher.models:
        if hasattr(model[1], 'simple_api_model_id'):
            if model[0].lower() == model_class:
                model = model[1](method)
                response = model.router(request)
                break
    return HttpResponse(response, content_type="application/json")
Ejemplo n.º 2
0
def test(request):
    response = simple_api.send_response(status='ok', data='It works')
    return HttpResponse(response, content_type="application/json")