From 0ca6a2b49028c1e880952d78655dbe3b3e164d48 Mon Sep 17 00:00:00 2001 From: Alexandru Date: Thu, 19 Sep 2024 11:12:29 +0300 Subject: [PATCH] fix indexed sites --- app.py | 9 +++++++-- templates/index.html | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index ecef652..84b3629 100644 --- a/app.py +++ b/app.py @@ -17,9 +17,14 @@ def parsetime(value): def index(): statement = 'SELECT "id", "name", "website", "comment", "date", "ip" FROM "entries" ORDER BY id DESC' cs.execute(statement) - return render_template("index.html", comments=cs.fetchall()) + comments = cs.fetchall() + statement = 'SELECT DISTINCT website FROM entries' + cs.execute(statement) + sites = cs.fetchall() + print(sites) + return render_template("index.html", comments=comments, sites=sites) -@app.route('/submit', methods=["POST"]) +@app.route('/gb/submit', methods=["POST"]) def submit(): errors = [] name = request.form.get("name") diff --git a/templates/index.html b/templates/index.html index 8fe7c7f..0683e61 100644 --- a/templates/index.html +++ b/templates/index.html @@ -14,7 +14,7 @@
- Sites indexed: {% for comment in comments %}{{comment[2]}} {% endfor %} + Sites indexed: {% for site in sites %}{{site[0]}} {% endfor %}
{% for comment in comments %}