Skip to content

Commit

Permalink
add hashtags page
Browse files Browse the repository at this point in the history
  • Loading branch information
ProgramminCat committed Jan 3, 2025
1 parent 30b82db commit 87f699d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ def explore_page():
"SELECT *, (SELECT count(*) FROM `likes` p WHERE p.short_id = shorts.id) likes FROM shorts ORDER BY likes DESC LIMIT 3;")
rv = cur.fetchall()

return render_template('explore.html', shorts=rv, session=session, logged_in = logged_in , page="explore")
return render_template('explore.html', shorts=rv, session=session, logged_in = logged_in, page="explore")

@app.route("/livefeed")
def livefeed_page():
Expand All @@ -552,6 +552,17 @@ def livefeed_page():

return render_template('explore.html', shorts=rv, session=session, logged_in = logged_in, page="livefeed")

@app.route("/tags/<tag>")
def tag_page(tag):
logged_in = "username" in session

cur = mysql.connection.cursor()
cur.execute(
"SELECT *, (SELECT count(*) FROM `likes` p WHERE p.short_id = shorts.id) likes FROM shorts WHERE description LIKE %s ORDER BY id DESC LIMIT 3;", ('%#' + tag + '%',))
rv = cur.fetchall()

return render_template('explore.html', shorts=rv, session=session, logged_in = logged_in, page="livefeed")

@app.route("/users/<user>")
def profile_page(user):
if "@" in user:
Expand Down

0 comments on commit 87f699d

Please sign in to comment.