From 5eb3cb6e46ca47d1115dee42b21c39117b4806d2 Mon Sep 17 00:00:00 2001 From: assar Date: Sat, 10 Jun 2017 14:15:31 +0200 Subject: [PATCH] Can't delete a new part --- server.py | 2 ++ static/script.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/server.py b/server.py index c649d36..a8e83b4 100644 --- a/server.py +++ b/server.py @@ -119,6 +119,8 @@ def alter(partID): @app.route('/parts/delete/') def delete(partID): + if partID < 0: + abort(400) s = text('delete from parts where id=:id;') r = db_engine.execute(s, id=partID) return '{"status":"ok"}' diff --git a/static/script.js b/static/script.js index 5e14db5..9916154 100644 --- a/static/script.js +++ b/static/script.js @@ -174,6 +174,8 @@ function text_filter(string) { } function delete_entry(partID) { + if (partID < 0) + return; if (!confirm('Delete the selected entry?')) return; $.ajax({