Refactoring of the counter code
This commit is contained in:
parent
28109eb586
commit
d3ff2419aa
@ -71,13 +71,10 @@ def home_page():
|
||||
context = {}
|
||||
|
||||
with magneticod_db:
|
||||
cur = magneticod_db.execute(
|
||||
"SELECT"
|
||||
" count(id) "
|
||||
"FROM torrents ;")
|
||||
context["counter"] = cur.fetchall()
|
||||
cur = magneticod_db.execute("SELECT count() FROM torrents ;")
|
||||
n_torrents = cur.fetchone()[0]
|
||||
|
||||
return flask.render_template("homepage.html",**context)
|
||||
return flask.render_template("homepage.html",n_torrents=n_torrents)
|
||||
|
||||
|
||||
@app.route("/torrents/")
|
||||
|
@ -17,7 +17,7 @@
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<div>Now with {{counter[0][0]}} torrents available !</div>
|
||||
Now with {{n_torrents}} torrents available !
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user