When checking whether a template exists, check the right table

pull/449/head
ElementalAlchemist 3 weeks ago committed by Christopher Usher
parent 5bd8fbd65f
commit 8ac23f2927

@ -687,7 +687,7 @@ def add_template(artist=None):
with app.db_manager.get_conn() as conn:
#check if name is already in the database
query = sql.SQL("""
SELECT name FROM events WHERE name = %s
SELECT name FROM templates WHERE name = %s
""")
results = database.query(conn, query, new_template['name'])
if results.fetchone() is not None:
@ -718,14 +718,14 @@ def update_template(name, artist=None):
with app.db_manage.get_conn() as conn:
#check if template is in database
query = sql.SQL("""
SELECT name FROM events WHERE name = %s
SELECT name FROM templates WHERE name = %s
""")
results = database.query(conn, query, name)
if results.fetchone() is None:
return 'Template with name {} does not exist'.format(name), 400
# check if new name is in database
query = sql.SQL("""
SELECT name FROM events WHERE name = %s
SELECT name FROM templates WHERE name = %s
""")
results = database.query(conn, query, new_template['name'])
if results.fetchone() is not None:

Loading…
Cancel
Save