attaching links to QR codes

master
Marek Baczynski 6 years ago
parent df0809cda9
commit 8dc0952df2

@ -12,6 +12,10 @@ systemURL = 'http://192.168.0.11:5000/'
with open('links.json', 'r') as infile: with open('links.json', 'r') as infile:
links = json.load(infile) links = json.load(infile)
def saveFile():
with open('links.json', 'w') as outfile:
json.dump(links, outfile)
def codeValidation(code): def codeValidation(code):
if len(code) not in range (5,6): if len(code) not in range (5,6):
return False return False
@ -52,6 +56,9 @@ def edit():
url = request.form.get("url") url = request.form.get("url")
if url is None: if url is None:
return render_template('editlink.html', code=code) return render_template('editlink.html', code=code)
#Saving the link:
links[code]['url']=url
saveFile()
return render_template('success.html') return render_template('success.html')
@app.route("/admin", methods=['GET', 'POST']) @app.route("/admin", methods=['GET', 'POST'])

Loading…
Cancel
Save