def specs_action(request): response = { 'error': 0, 'message': '', } if request.method == 'GET': specs = get_all_specs() response['specs'] = specs elif request.method == 'POST': post_json = json.loads(request.body) response = _spec_action(post_json, response) else: response['error'] = 1 response['message'] = 'Unknown HTTP method: ' + request.method return HttpResponse(json.dumps(response), content_type='application/json')
def spec_list(request): specs = get_all_specs() return render(request, 'spec_maker/spec_list.html', {'specs': specs})