Init tag bookmark and add route bookmark

This commit is contained in:
duongban
2021-05-29 21:01:55 +07:00
parent d9e33d0b03
commit 64b805c69b

View File

@@ -362,6 +362,9 @@ def init_tag():
db.execute('INSERT INTO tags (tagName) VALUES (?)',
["code"])
db.commit()
db.execute('INSERT INTO tags (tagName) VALUES (?)',
["bookmark"])
db.commit()
@app.route('/show')
def show():
@@ -391,5 +394,15 @@ def getTag(tag_id):
tag = cur.fetchone()
return tag
@app.route('/bookmark/<card_type>/<card_id>')
def bookmark(card_type, card_id):
if not session.get('logged_in'):
return redirect(url_for('login'))
db = get_db()
db.execute('UPDATE cards SET type = ? WHERE id = ?',[card_type,card_id])
db.commit()
flash('Card saved.')
return redirect(url_for('mem', card_type=card_type))
if __name__ == '__main__':
app.run(host='0.0.0.0')