Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
41 changes: 41 additions & 0 deletions project/accounts/templates/accounts/user_civis.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{% extends "base.html" %}

{% block extra-css%}{% endblock extra-css %}

{% block content %}
<div class="following-total">
<div>
{{ profile.following.count }} Following
</div>
</div>
{% for following in profile.following.all %}
<div class="col s12 m6">
<div class="user-chip chip white">
<div class="user-chip-contents">
<a href="/profile/{{ following.user.username }}/">
<img src="{{ following.profile_image_url }}" alt="{{ following.user.username }}">
<!--<div class="name">
{{ following.first_name}} {{ following.last_name }}
</div>
<div class="light-gray-text atname">
@{{ following.user.username }}
</div>-->
</a>
</div>
</div>
</div>
{% empty %}
<div class="section no-state">
<div class="container">
<div class="section">
<div class="center title-lato grey-text">
Not following any users
</div>
</div>
</div>
</div>
{% endfor %}

{% endblock content %}

{% block extra-js %}{% endblock extra-js %}
6 changes: 6 additions & 0 deletions project/accounts/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
ProfileUnfollow,
RegisterView,
SettingsView,
UserFollowing,
UserProfileView,
expunge_user,
)
Expand Down Expand Up @@ -37,6 +38,11 @@
ProfileUnfollow.as_view(),
name="profile-unfollow",
),
path(
"profile/<str:username>/following",
UserFollowing.as_view(),
name="profile-following",
),
path(
"accounts/password_reset/",
PasswordResetView.as_view(),
Expand Down
15 changes: 15 additions & 0 deletions project/accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,21 @@ def get(self, request, username=None):
)


class UserFollowing(LoginRequiredMixin, View):
"""A view that shows list of users following user with given username"""

def get(self, request, username=None):
profile = get_object_or_404(Profile, user__username=username)

return TemplateResponse(
request,
"user_civis.html",
{
"profile": profile,
},
)


@login_required
def expunge_user(request):
"""
Expand Down