Fixed get followers method, now shows followers count on profile

This commit is contained in:
Socks 2018-03-28 02:04:28 +01:00
parent 81d09f60e6
commit 411cf7f7b0
3 changed files with 7 additions and 2 deletions

View file

@ -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)

View file

@ -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):

View file

@ -29,7 +29,8 @@
</div>
<div class="card-body">
{{ posts|count }} Posts <br />
{{ user.following|count }} Following
{{ user.following|count }} Following <br />
{{ followers|count }} Followers
<hr />
{% if user.profile.location %} <i class="far fa-fw fa-map-marker"></i> {{ user.profile.location }} <br>{% endif %}
{% if user.profile.gender %} <i class="far fa-fw fa-transgender-alt"></i> {{ user.profile.gender }} {% endif %}