Fixed get followers method, now shows followers count on profile
This commit is contained in:
parent
81d09f60e6
commit
411cf7f7b0
3 changed files with 7 additions and 2 deletions
|
@ -76,6 +76,7 @@ def profile(name=None):
|
||||||
logged_in=logged_in,
|
logged_in=logged_in,
|
||||||
theme=accounts.get_theme(logged_in),
|
theme=accounts.get_theme(logged_in),
|
||||||
following=accounts.is_following(logged_in, name),
|
following=accounts.is_following(logged_in, name),
|
||||||
|
followers=accounts.get_followers(name),
|
||||||
posts=posts)
|
posts=posts)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,10 @@ def update_profile(username, details):
|
||||||
def get_followers(username):
|
def get_followers(username):
|
||||||
if not account_exists(username):
|
if not account_exists(username):
|
||||||
return False
|
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):
|
def validate_username(username):
|
||||||
|
|
|
@ -29,7 +29,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
{{ posts|count }} Posts <br />
|
{{ posts|count }} Posts <br />
|
||||||
{{ user.following|count }} Following
|
{{ user.following|count }} Following <br />
|
||||||
|
{{ followers|count }} Followers
|
||||||
<hr />
|
<hr />
|
||||||
{% if user.profile.location %} <i class="far fa-fw fa-map-marker"></i> {{ user.profile.location }} <br>{% endif %}
|
{% 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 %}
|
{% if user.profile.gender %} <i class="far fa-fw fa-transgender-alt"></i> {{ user.profile.gender }} {% endif %}
|
||||||
|
|
Loading…
Add table
Reference in a new issue