From d55f7dcdd9490d70d4758930d1e4fa59d5de57cf Mon Sep 17 00:00:00 2001 From: Flancian <0@flancia.org> Date: Sun, 22 Nov 2020 16:25:28 +0100 Subject: [PATCH] Show subnode count in users page. --- app/db.py | 4 ++++ app/templates/users.html | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/db.py b/app/db.py index e4aba74..aea34c1 100644 --- a/app/db.py +++ b/app/db.py @@ -103,6 +103,10 @@ class User: def __init__(self, user): self.uri = user self.url = '/user/' + self.uri + self.subnodes = subnodes_by_user(user) + + def size(self): + return len(self.subnodes) def path_to_uri(path): return path.replace(config.AGORA_PATH + '/', '') diff --git a/app/templates/users.html b/app/templates/users.html index 64ef4d3..2108b85 100644 --- a/app/templates/users.html +++ b/app/templates/users.html @@ -19,7 +19,7 @@

Users

{% for user in users %} -{{user.uri}}
+{{user.uri}} ({{user.size()}})
{% endfor %}
{% endblock %}