fix indexed sites

This commit is contained in:
Alexandru 2024-09-19 11:12:29 +03:00
parent ccdd13a188
commit 0ca6a2b490
2 changed files with 8 additions and 3 deletions

9
app.py
View File

@ -17,9 +17,14 @@ def parsetime(value):
def index(): def index():
statement = 'SELECT "id", "name", "website", "comment", "date", "ip" FROM "entries" ORDER BY id DESC' statement = 'SELECT "id", "name", "website", "comment", "date", "ip" FROM "entries" ORDER BY id DESC'
cs.execute(statement) 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(): def submit():
errors = [] errors = []
name = request.form.get("name") name = request.form.get("name")

View File

@ -14,7 +14,7 @@
<button>submit</button> <button>submit</button>
</form> </form>
<hr> <hr>
<b>Sites indexed</b>: {% for comment in comments %}<a href="http://{{comment[2]}}">{{comment[2]}}</a> {% endfor %} <b>Sites indexed</b>: {% for site in sites %}<a href="http://{{site[0]}}">{{site[0]}}</a> {% endfor %}
<hr> <hr>
{% for comment in comments %} {% for comment in comments %}
<div class="comment"> <div class="comment">