|
|
|
@ -110,6 +110,9 @@ def create():
|
|
|
|
|
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']
|
|
|
|
|
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 (?,?)',
|
|
|
|
|
(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']
|
|
|
|
|