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'])