Skip to content

Commit

Permalink
Issue #50 - Select notification logic from the database for a user
Browse files Browse the repository at this point in the history
  • Loading branch information
Shefali-Upadhyaya committed Aug 6, 2023
1 parent deb58dc commit d2f67a9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ def delete_user(username):

return redirect(url_for('home'))

@app.route('/notifications')
def notifications():
db = Database().db
cursor = db.cursor()
cursor.execute(f"select * from notifications where username= '{session['username']}' and seen=0;")
db.commit()
item = [dict(keyid=row[0],alert = row[2]) for row in cursor.fetchall()]
# cursor.execute("update user set is_admin=1 where username='" + username + "';")
cursor.execute(f"update notifications set seen=1 where username= '{session['username']}' and seen=0;")
db.commit()
return render_template('notifications.html',session=session,items=item)

# Suspend user from admin panel
@app.route('/suspend-user/<username>')
def suspend_user(username):
Expand Down

0 comments on commit d2f67a9

Please sign in to comment.