lsit of all links (for admin) and stub of blank generator form (also for admin)

master
Marek Baczynski 6 years ago
parent 8dc0952df2
commit 1aaf5bd1b1

15
qr.py

@ -61,13 +61,24 @@ def edit():
saveFile()
return render_template('success.html')
@app.route("/admin", methods=['GET', 'POST'])
@app.route("/admin")
def admin():
return render_template('admin.html')
@app.route("/generate", methods=['GET', 'POST'])
def generate():
howmany = request.form.get("howmany")
if howmany is None:
return render_template('generate.html')
return render_template("message.html", message="Totally generated {} many codes right now.".format(howmany))
@app.route("/list")
def list():
return render_template('message.html', message='Comming soon!™')
linklist = []
for key, value in links.items():
if len(value['url'])>0:
linklist.append({'code':key, 'url':value['url']})
return render_template('list.html', linklist=linklist)
@app.route('/', defaults={'path': ''})
@app.route('/<path:path>')

@ -58,6 +58,12 @@ a{
font-weight: 800;
}
.linkonalist{
color: #202222;
font-size: medium;
font-weight: 500;
}
a:link {
text-decoration: none;
}

@ -2,5 +2,8 @@
{% block content %}
<p>Welcome Mr. admin person.</p>
<p>This funcionality has not been implemented yet. Please return later</p>
<p><a href="/list">List all attached links</a></p>
<p><a href="/empty">Show unused labels</a></p>
<p><a href="/generate">Generate blank labels</a></p>
<p><a href="/logout">Log out</a></p>
{% endblock %}

@ -0,0 +1,10 @@
{% extends 'base.html' %}
{% block content %}
<form action=/generate method="post">
How many?:<br />
<input type="number" name="howmany" value="20"/><br />
<button type="submit" class="graybar" >Generate </button><br />
Note: It is best to print the generated codes immediatly from the result of this generation.
</form>
{% endblock %}

@ -0,0 +1,14 @@
{% extends 'base.html' %}
{% block content %}
<p>ALL used links: (this many)</p>
{% for label in linklist %}
<p>
<span class="code">{{label['code']}}</span>:
<a href="/code/{{label['code']}}.png" class="linkonalist">Show QR</a> | <a href="/edit" class="linkonalist">Edit</a>
<br />
<a href="{{label['url']}}" class="linkonalist">{{label['url']}}</a>
<hr>
</p>
{% endfor %}
{% endblock %}
Loading…
Cancel
Save