✨
This commit is contained in:
@ -11,12 +11,10 @@ Login = Blueprint('Login', __name__)
|
||||
@Login.route("/")
|
||||
@Login.route("/home")
|
||||
def home():
|
||||
print(current_user.is_authenticated)
|
||||
if current_user.is_authenticated:
|
||||
posts = get_posts_for_user(current_user.get_id())
|
||||
else:
|
||||
posts = []
|
||||
print(posts)
|
||||
return render_template('home.html', posts=posts)
|
||||
|
||||
|
||||
|
@ -112,4 +112,15 @@ def select_users_by_email(email):
|
||||
return user
|
||||
|
||||
def get_posts_for_user(user_id):
|
||||
return []
|
||||
cur = conn.cursor()
|
||||
sql_call = """
|
||||
SELECT * FROM posts
|
||||
WHERE group_id in (
|
||||
SELECT group_id FROM users_groups
|
||||
WHERE user_id = %s
|
||||
)
|
||||
"""
|
||||
cur.execute(sql_call, (user_id,))
|
||||
user = [Post(i) for i in cur.fetchmany(50)] if cur.rowcount > 0 else []
|
||||
cur.close()
|
||||
return user
|
||||
|
Reference in New Issue
Block a user