예제 #1
0
파일: views.py 프로젝트: echodaemon/crits
def update_ci(request, indicator_id, ci_type):
    """
    Update an indicator's confidence/impact. Should be an AJAX POST.

    :param request: Django request object (Required)
    :type request: :class:`django.http.HttpRequest`
    :param indicator_id: The ObjectId of the indicator to update.
    :type indicator_id: str
    :param ci_type: Whether we are updating confidence or impact.
    :type ci_type: str ("confidence", "impact")
    :returns: :class:`django.http.HttpResponse`
    """

    if request.method == "POST" and request.is_ajax():
        value = request.POST["value"]
        analyst = request.user.username
        return HttpResponse(json.dumps(ci_update(indicator_id, ci_type, value, analyst)), mimetype="application/json")
예제 #2
0
def update_ci(request, indicator_id, ci_type):
    """
    Update an indicator's confidence/impact. Should be an AJAX POST.

    :param request: Django request object (Required)
    :type request: :class:`django.http.HttpRequest`
    :param indicator_id: The ObjectId of the indicator to update.
    :type indicator_id: str
    :param ci_type: Whether we are updating confidence or impact.
    :type ci_type: str ("confidence", "impact")
    :returns: :class:`django.http.HttpResponse`
    """

    if request.method == "POST" and request.is_ajax():
        value = request.POST['value']
        analyst = request.user.username
        return HttpResponse(json.dumps(
            ci_update(indicator_id, ci_type, value, analyst)),
                            content_type="application/json")