def set_sample_filename(request): """ Set a Sample filename. Should be an AJAX POST. :param request: Django request object (Required) :type request: :class:`django.http.HttpRequest` :returns: :class:`django.http.HttpResponse` """ if request.method == 'POST': filename = request.POST.get('filename', None) id_ = request.POST.get('id', None) analyst = request.user.username return HttpResponse(json.dumps( update_sample_filename(id_, filename, analyst)), content_type="application/json") else: error = "Expected POST" return render(request, "error.html", {"error": error})
def set_sample_filename(request): """ Set a Sample filename. Should be an AJAX POST. :param request: Django request object (Required) :type request: :class:`django.http.HttpRequest` :returns: :class:`django.http.HttpResponse` """ if request.method == 'POST': filename = request.POST.get('filename', None) id_ = request.POST.get('id', None) analyst = request.user.username return HttpResponse(json.dumps(update_sample_filename(id_, filename, analyst)), content_type="application/json") else: error = "Expected POST" return render(request, "error.html", {"error" : error })
def set_sample_filename(request): """ Set a Sample filename. Should be an AJAX POST. :param request: Django request object (Required) :type request: :class:`django.http.HttpRequest` :returns: :class:`django.http.HttpResponse` """ if request.method == 'POST': filename = request.POST.get('filename', None) id_ = request.POST.get('id', None) analyst = request.user.username result = update_sample_filename(id_, filename, analyst) set_releasability_flag('Sample', id_, analyst) return HttpResponse(json.dumps(result), mimetype="application/json") else: error = "Expected POST" return render_to_response("error.html", {"error": error}, RequestContext(request))