From 8dc0952df27a052c48d7e24d1759f6ba79e54970 Mon Sep 17 00:00:00 2001 From: Marek Baczynski Date: Tue, 16 Oct 2018 19:55:16 +0200 Subject: [PATCH] attaching links to QR codes --- qr.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/qr.py b/qr.py index 00874d4..fe13f85 100644 --- a/qr.py +++ b/qr.py @@ -12,6 +12,10 @@ systemURL = 'http://192.168.0.11:5000/' with open('links.json', 'r') as infile: links = json.load(infile) +def saveFile(): + with open('links.json', 'w') as outfile: + json.dump(links, outfile) + def codeValidation(code): if len(code) not in range (5,6): return False @@ -52,6 +56,9 @@ def edit(): url = request.form.get("url") if url is None: return render_template('editlink.html', code=code) + #Saving the link: + links[code]['url']=url + saveFile() return render_template('success.html') @app.route("/admin", methods=['GET', 'POST'])