コード例 #1
0
def update(fan_id):
    fan = User.get_by_id(fan_id)
    if current_user.approve_request(fan):
        flash(f"You approved follow request from {fan.username}","success")
        return redirect(url_for('users.show',username=current_user.username))
    else:
        flash("Something went wrong, try again later.","danger")
        return render_template('users/show.html',username=current_user.username)
コード例 #2
0
def approve(fan_id):
    fan = User.get_by_id(fan_id)

    if current_user.approve_request(fan):
        flash(f"You approve {fan.username}'s request", "primary")
        return redirect(url_for('users.show', username=current_user.username))
    else:
        flash(f"Unable to approve this user, try again", "danger")
        return redirect(url_for('users.show', username=current_user.username))
コード例 #3
0
def approve(fan_id):
    fan = User.get_by_id(fan_id)

    if current_user.approve_request(fan):
        flash("Request approved", "info")
        return redirect(url_for('users.show', username=current_user.username))
    else:
        flash("Unable to approve the request, try again", "info")
        return redirect(url_for('users.show', username=current_user.username))
コード例 #4
0
ファイル: main.py プロジェクト: tckmn/psetpartners
def approve_request(request_id):
    try:
        msg = current_user.approve_request(request_id)
        print(msg)
        flash_notify(msg)
    except ValueError as err:
        app.logger.error(
            "Error processing approve response from %s to request id %s" %
            (current_user.kerb, request_id))
        flash_error("Error processing response: %s" % err)
    return redirect(url_for(".student"))
コード例 #5
0
def approve_request(request_id):
    if not current_user.is_student:
        app.logger.error(
            "Error processing approve response from %s to request id %s: %s" %
            (current_user.kerb, request_id, "User is not a student"))
        flash_error("Error processing response: %s" %
                    "you are not logged in as a student")
        return redirect(url_for("index"))
    try:
        msg = current_user.approve_request(request_id)
        flash_notify(msg)
    except ValueError as err:
        app.logger.error(
            "Error processing approve response from %s to request id %s" %
            (current_user.kerb, request_id))
        flash_error("Error processing response: %s" % err)
    return redirect(url_for("student"))