Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #497 #498

Merged
merged 1 commit into from
Sep 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bugheist/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
url(r'^like_issue/(?P<issue_pk>\d+)/$', website.views.like_issue,name="like_issue"),
url(r'^issue/edit/$', website.views.IssueEdit),
url(r'^issue/update/$', website.views.UpdateIssue),
url(r'^like_issue/(?P<username>\w+)/$', website.views.follower_list,name="follower_list"),
url(r'^like_issue/(?P<username>[^/]+)/$', website.views.follower_list,name="follower_list"),
url(r'^following_list/(?P<username>[^/]+)/$', website.views.following_list,name="following_list"),
url(r'^issue/(?P<slug>\w+)/$', IssueView.as_view(), name="issue_view"),
url(r'^follow_user/(?P<user>[^/]+)/', website.views.follow_user,name="follow_user"),
url(r'^all_activity/$', AllIssuesView.as_view(), name="all_activity"),
Expand Down
2 changes: 1 addition & 1 deletion website/templates/followers.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
</form>
</div>

<h4>Following: <strong>{{ follows }}</strong></h4>
<h4>Following: <strong><a href="{% url 'following_list' username=user %}"> {{ follows }} </a></strong></h4>
<h4>Followed by: <strong><a href="{% url 'follower_list' username=user %}">{{ followed_by }}</a></strong></h4>

23 changes: 23 additions & 0 deletions website/templates/following_list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{% extends "base.html" %}
{% load gravatar %}
{% load staticfiles %}
{% load humanize %}

{% block content %}
<div class="col-md-8 col-md-offset-2">
<h2> Following: </h2>
<div class="list-group">
{% for user in following %}
<div class="list-group-item">
{% if user.socialaccount_set.all.0.get_avatar_url %}
<img src="{{user.socialaccount_set.all.0.get_avatar_url}}" height="50px">
{% else %}
<img src="{% gravatar_url user.email 50 %}">
{% endif %}
<a href="/profile/{{user.username}}">{{user.username}}</a>
</div>
{% endfor %}
</div>
</div>

{% endblock %}
14 changes: 13 additions & 1 deletion website/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,7 @@ def like_issue(request,issue_pk):
context['object'] = issue
context['likes'] = total_votes
return render(request,'likers.html',context)

def follower_list(request,username):
user = User.objects.get(username=username)
context={}
Expand All @@ -910,4 +911,15 @@ def follower_list(request,username):
user = User.objects.get(username=str(userprofile.user))
lis.append(user)
context['followers'] = lis
return render(request,'follower_list.html',context)
return render(request,'follower_list.html',context)

def following_list(request,username):
user = User.objects.get(username=username)
context={}
lis = []
prof_list = user.userprofile.follower.all()
for userprofile in prof_list:
user = User.objects.get(username=str(userprofile.user))
lis.append(user)
context['following'] = lis
return render(request,'following_list.html',context)