hanabiapp.views.consent
1from flask import Blueprint, render_template, redirect, request, url_for 2from flask_login import login_required, current_user 3from .. import db 4 5bp = Blueprint('consent', __name__) 6 7@bp.route('/consent', methods=['GET', 'POST']) 8@login_required 9def consent(): 10 """ 11 ユーザーの同意を処理する関数. 12 13 - POSTリクエストの場合,ユーザーが同意した場合は `consent` フラグを True に設定し,データベースを更新する. 14 - GETリクエストの場合,`consent.html` を表示する. 15 16 Returns: 17 Response: 同意後にホームページへリダイレクト,または同意ページをレンダリング 18 """ 19 if request.method == 'POST': 20 if 'agree' in request.form: 21 current_user.consent = True 22 db.session.commit() 23 return redirect(url_for('home.home')) 24 return render_template('consent.html')
bp =
<Blueprint 'consent'>
@bp.route('/consent', methods=['GET', 'POST'])
@login_required
def
consent():
8@bp.route('/consent', methods=['GET', 'POST']) 9@login_required 10def consent(): 11 """ 12 ユーザーの同意を処理する関数. 13 14 - POSTリクエストの場合,ユーザーが同意した場合は `consent` フラグを True に設定し,データベースを更新する. 15 - GETリクエストの場合,`consent.html` を表示する. 16 17 Returns: 18 Response: 同意後にホームページへリダイレクト,または同意ページをレンダリング 19 """ 20 if request.method == 'POST': 21 if 'agree' in request.form: 22 current_user.consent = True 23 db.session.commit() 24 return redirect(url_for('home.home')) 25 return render_template('consent.html')
ユーザーの同意を処理する関数.
- POSTリクエストの場合,ユーザーが同意した場合は
consent
フラグを True に設定し,データベースを更新する. - GETリクエストの場合,
consent.html
を表示する.
Returns:
Response: 同意後にホームページへリダイレクト,または同意ページをレンダリング