diff --git a/Tweeder.py b/Tweeder.py index 11b9116..79ee7db 100644 --- a/Tweeder.py +++ b/Tweeder.py @@ -76,6 +76,7 @@ def profile(name=None): logged_in=logged_in, theme=accounts.get_theme(logged_in), following=accounts.is_following(logged_in, name), + followers=accounts.get_followers(name), posts=posts) diff --git a/backend/accounts.py b/backend/accounts.py index 160b3d6..d8918b0 100644 --- a/backend/accounts.py +++ b/backend/accounts.py @@ -55,7 +55,10 @@ def update_profile(username, details): def get_followers(username): if not account_exists(username): return False - return accounts_db.find({"following": account_details(username)['_id']}) + followers = [] + for follower in accounts_db.find({"following": account_details(username)['_id']}): + followers.append(follower['_id']) + return followers def validate_username(username): diff --git a/templates/profile.html b/templates/profile.html index 2b0495f..d46709d 100644 --- a/templates/profile.html +++ b/templates/profile.html @@ -29,7 +29,8 @@
{{ posts|count }} Posts
- {{ user.following|count }} Following + {{ user.following|count }} Following
+ {{ followers|count }} Followers
{% if user.profile.location %} {{ user.profile.location }}
{% endif %} {% if user.profile.gender %} {{ user.profile.gender }} {% endif %}