Exemplo n.º 1
0
Arquivo: views.py Projeto: pmac/basket
def custom_unsub_reason(request):
    """Update the reason field for the user, which logs why the user
    unsubscribed from all newsletters."""

    if 'token' not in request.POST or 'reason' not in request.POST:
        return HttpResponseJSON({
            'status': 'error',
            'desc': 'custom_unsub_reason requires the `token` '
                    'and `reason` POST parameters',
            'code': errors.BASKET_USAGE_ERROR,
        }, 400)

    update_custom_unsub.delay(request.POST['token'], request.POST['reason'])
    return HttpResponseJSON({'status': 'ok'})
Exemplo n.º 2
0
def custom_unsub_reason(request):
    """Update the reason field for the user, which logs why the user
    unsubscribed from all newsletters."""

    if 'token' not in request.POST or 'reason' not in request.POST:
        return HttpResponseJSON({
            'status': 'error',
            'desc': 'custom_unsub_reason requires the `token` '
                    'and `reason` POST parameters',
            'code': errors.BASKET_USAGE_ERROR,
        }, 400)

    update_custom_unsub.delay(request.POST['token'], request.POST['reason'])
    return HttpResponseJSON({'status': 'ok'})
Exemplo n.º 3
0
def custom_unsub_reason(request):
    """Update the reason field for the user, which logs why the user
    unsubscribed from all newsletters."""

    if "token" not in request.POST or "reason" not in request.POST:
        return HttpResponseJSON(
            {
                "status": "error",
                "desc": "custom_unsub_reason requires the `token` "
                "and `reason` POST parameters",
                "code": errors.BASKET_USAGE_ERROR,
            },
            400,
        )

    update_custom_unsub.delay(request.POST["token"], request.POST["reason"])
    return HttpResponseJSON({"status": "ok"})