-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaccount.py
More file actions
29 lines (20 loc) · 836 Bytes
/
account.py
File metadata and controls
29 lines (20 loc) · 836 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from flask import Blueprint, render_template, redirect, url_for
from flask_login import login_required, current_user
""" This file handle Authenticated user account logic:
Showing account page, created votes and
votes user has voted. """
account = Blueprint('account', __name__)
# Account Page
@account.route('/account', methods=['GET'])
@login_required
def account_logic():
return render_template("account.html", user=current_user)
# User created votes and user voted votes
@account.route('/account/votes/<name>', methods=['GET'])
@login_required
def user_voted(name):
if name == "voted":
return render_template("user_votes.html", user=current_user)
if name == "created":
return render_template("user_created.html", user=current_user)
return redirect(url_for('views.home'))