def my_page(): if 'username' not in session: return redirect('/login') if request.method == 'GET': nm = NewsModel(db.get_connection()) nm.init_table() um = UsersModel(db.get_connection()) um.init_table() em = um.get_email(session['username']) uname = session['username'] image = um.get_avatar(uname) return render_template('account.html', username=uname, news=nm.get_all(uname), email=em, own="True", image=image)
def show_user(uname): if 'username' not in session: return redirect('/login') nm = NewsModel(db.get_connection()) nm.init_table() um = UsersModel(db.get_connection()) um.init_table() em = um.get_email(session['username']) image = um.get_avatar(uname) if uname == session['username']: owning = 'True' else: owning = 'False' if request.method == "GET": print(nm.get_all(uname)) return render_template('account.html', username=uname, news=nm.get_all(uname), email=em, own=owning, image=image)