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

master
grgr 2 years ago
parent b093c8b5d3
commit 0171075d38

Binary file not shown.

@ -109,11 +109,14 @@ def create():
(new_topic,))
conn.commit()
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_tag,)).fetchone()['id']
(topic_tag,)).fetchone()['id']
conn.execute('INSERT INTO topic_cards (topic_id, card_id) VALUES (?,?)',
(topic_id, cat_id))
(topic_id, cat_id))
if not content:
flash('plz write a content!')
@ -121,10 +124,15 @@ def create():
cat_id = conn.execute('SELECT id FROM categories WHERE category_name = (?);',
(category_name,)).fetchone()['id']
conn.execute('INSERT INTO cards (content, category_id) VALUES (?,?)',
(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.close()
return redirect(url_for('home'))
@ -147,6 +155,7 @@ def edit(id):
categories = conn.execute(
'SELECT category_name FROM categories;').fetchall()
topics = conn.execute('SELECT content FROM topics;').fetchall()
if request.method == 'POST':
content = request.form['content']

Binary file not shown.
Loading…
Cancel
Save