add: edit
This commit is contained in:
@@ -50,12 +50,9 @@ def submit():
|
||||
cursor.execute('SELECT 1 FROM items WHERE name = ?', (value,))
|
||||
item = cursor.fetchone()
|
||||
if item:
|
||||
conn.close()
|
||||
return redirect(url_for("mainpage"))
|
||||
cursor.execute(
|
||||
"INSERT INTO items (name, time, noshutdown) VALUES (?, ?, ?)",
|
||||
(value, time_value, noshutdown)
|
||||
)
|
||||
cursor.execute("UPDATE items SET time = ?, noshutdown = ? WHERE name = ?", (time_value, noshutdown, value))
|
||||
else:
|
||||
cursor.execute("INSERT INTO items (name, time, noshutdown) VALUES (?, ?, ?)", (value, time_value, noshutdown))
|
||||
conn.commit()
|
||||
conn.close()
|
||||
return redirect(url_for("mainpage"))
|
||||
|
||||
Reference in New Issue
Block a user