From 2862bf2bddb5efafe5e41a24ad5f48164b185aba Mon Sep 17 00:00:00 2001 From: jakobsn Date: Tue, 12 Nov 2019 16:29:51 +0100 Subject: [PATCH] file handling --- src/app/models/project.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/app/models/project.py b/src/app/models/project.py index 31e6a60..b9b5180 100644 --- a/src/app/models/project.py +++ b/src/app/models/project.py @@ -145,7 +145,17 @@ def set_task_file(task_id, filename): cursor = db.cursor() query = ("INSERT INTO task_files (taskid, filename) VALUES (\"" + task_id + "\", \"" + filename + "\")") + print(query) cursor.execute(query) db.commit() cursor.close() - \ No newline at end of file + +def get_task_files(task_id): + cursor = db.cursor() + query = ("SELECT filename FROM task_files WHERE taskid = \"" + str(task_id) + "\"") + cursor.execute(query) + filenames = cursor.fetchall() + print(query) + print(filenames) + cursor.close + return filenames