it doesn't show the new topic after submit, not fixed

master
grgr 2 years ago
parent b093c8b5d3
commit 0171075d38

Binary file not shown.

@ -110,6 +110,9 @@ def create():
conn.commit() conn.commit()
topic_tag = new_topic topic_tag = new_topic
cat_id = conn.execute('SELECT id FROM categories WHERE category_name = (?);',
(category_name,)).fetchone()['id']
topic_id = conn.execute('SELECT id FROM topics WHERE content = (?);', topic_id = conn.execute('SELECT id FROM topics WHERE content = (?);',
(topic_tag,)).fetchone()['id'] (topic_tag,)).fetchone()['id']
conn.execute('INSERT INTO topic_cards (topic_id, card_id) VALUES (?,?)', conn.execute('INSERT INTO topic_cards (topic_id, card_id) VALUES (?,?)',
@ -125,6 +128,11 @@ def create():
conn.execute('INSERT INTO cards (content, category_id) VALUES (?,?)', conn.execute('INSERT INTO cards (content, category_id) VALUES (?,?)',
(content, cat_id)) (content, cat_id))
topic_id = conn.execute('SELECT id FROM topics WHERE content = (?);',
(topic_tag,)).fetchone()['id']
conn.execute('INSERT INTO topic_cards (topic_id, card_id) VALUES (?,?)',
(topic_id, cat_id))
conn.commit() conn.commit()
conn.close() conn.close()
return redirect(url_for('home')) return redirect(url_for('home'))
@ -147,6 +155,7 @@ def edit(id):
categories = conn.execute( categories = conn.execute(
'SELECT category_name FROM categories;').fetchall() 'SELECT category_name FROM categories;').fetchall()
topics = conn.execute('SELECT content FROM topics;').fetchall()
if request.method == 'POST': if request.method == 'POST':
content = request.form['content'] content = request.form['content']

Binary file not shown.
Loading…
Cancel
Save