diff --git a/project/accounts/templates/accounts/profile_following.html b/project/accounts/templates/accounts/profile_following.html new file mode 100644 index 00000000..496175b7 --- /dev/null +++ b/project/accounts/templates/accounts/profile_following.html @@ -0,0 +1,34 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block content %} +
+
+ {% blocktranslate %} + {{ profile.following.count }} following + {% endblocktranslate %} +
+
+ {% for following in profile.following.all %} +
+
+
+ + {{ following.user.username }} + +
+
+
+ {% empty %} +
+
+
+
+ {% translate "Not following any users" %} +
+
+
+
+ {% endfor %} + +{% endblock content %} diff --git a/project/accounts/urls.py b/project/accounts/urls.py index f9c4ceb9..a008713b 100644 --- a/project/accounts/urls.py +++ b/project/accounts/urls.py @@ -8,6 +8,7 @@ ProfileUnfollow, RegisterView, SettingsView, + ProfileFollowing, UserProfileView, expunge_user, ) @@ -37,6 +38,11 @@ ProfileUnfollow.as_view(), name="profile-unfollow", ), + path( + "profile//following", + ProfileFollowing.as_view(), + name="profile-following", + ), path( "accounts/password_reset/", PasswordResetView.as_view(), diff --git a/project/accounts/views.py b/project/accounts/views.py index e0d68b60..a49d77b6 100644 --- a/project/accounts/views.py +++ b/project/accounts/views.py @@ -188,6 +188,24 @@ def get(self, request, username=None): ) +class ProfileFollowing(LoginRequiredMixin, View): + """ + A view that shows list of profiles + that profile with given username is following + """ + + def get(self, request, username=None): + profile = get_object_or_404(Profile, user__username=username) + + return TemplateResponse( + request, + "profile_following.html", + { + "profile": profile, + }, + ) + + @login_required def expunge_user(request): """