Example #1
0
def process_referral(request, code):
    referral = get_object_or_404(Referral, code=code)
    session_key = ensure_session_key(request)
    referral.respond(request, "RESPONDED")
    response = redirect(referral.redirect_to)
    if request.user.is_anonymous():
        response.set_cookie("anafero-referral", "%s:%s" % (code, session_key))
    else:
        response.delete_cookie("anafero-referral")

    return response
Example #2
0
def process_referral(request, code):
    referral = get_object_or_404(Referral, code=code)
    session_key = ensure_session_key(request)
    referral.respond(request, "RESPONDED")
    response = redirect(referral.redirect_to)
    if request.user.is_anonymous():
        response.set_cookie(
            "anafero-referral",
            "%s:%s" % (code, session_key)
        )
    else:
        response.delete_cookie("anafero-referral")
    
    return response
Example #3
0
def process_referral(request, code):
    referral = get_object_or_404(Referral, code=code)
    session_key = ensure_session_key(request)
    referral.respond(request, "RESPONDED")
    try:
        response = redirect(request.GET[
            getattr(settings, "ANAFERO_REDIRECT_ATTRIBUTE", "redirect_to")]
        )
    except KeyError:
        response = redirect(referral.redirect_to)
    if request.user.is_anonymous():
        response.set_cookie(
            "anafero-referral",
            "%s:%s" % (code, session_key)
        )
    else:
        response.delete_cookie("anafero-referral")

    return response