From b77c030ff057405daa426e521c950d00ba46cac7 Mon Sep 17 00:00:00 2001 From: Marek Baczynski Date: Wed, 17 Oct 2018 15:52:26 +0200 Subject: [PATCH] listing all unused lables in admin panel, and imporvements to listing used ones --- qr-labels.py | 10 +++++++++- templates/list.html | 2 +- templates/listempty.html | 11 +++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 templates/listempty.html diff --git a/qr-labels.py b/qr-labels.py index 9e61703..7a8dbf6 100644 --- a/qr-labels.py +++ b/qr-labels.py @@ -111,7 +111,15 @@ def list(): 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) + return render_template('list.html', linklist=linklist, count=len(linklist)) + +@app.route("/empty") +def showEmptyCodes(): + linklist = [] + for key, value in links.items(): + if value['url']=='': + linklist.append({'code':key, 'url':value['url']}) + return render_template('listempty.html', linklist=linklist, count=len(linklist)) @app.route('/', defaults={'path': ''}) @app.route('/') diff --git a/templates/list.html b/templates/list.html index 511d071..a5a7852 100644 --- a/templates/list.html +++ b/templates/list.html @@ -1,7 +1,7 @@ {% extends 'base.html' %} {% block content %} -

ALL used links: (this many)

+

Showing all {{count}} attached links

{% for label in linklist %}

{{label['code']}}: diff --git a/templates/listempty.html b/templates/listempty.html new file mode 100644 index 0000000..2c86447 --- /dev/null +++ b/templates/listempty.html @@ -0,0 +1,11 @@ +{% extends 'base.html' %} + +{% block content %} +

Showing all {{count}} unused labels:

+ {% for label in linklist %} +

+ {{label['code']}}: + Show QR | Edit +

+ {% endfor %} +{% endblock %} \ No newline at end of file