Repository: CiviWiki/OpenCiviWiki

Issue:
Add "Issues" tab to the user profile view
We recently removed some features from the user Profile view and now want to reimplement them using only Django.

This task will be to add an "Issues" tab to the user profile view. The tab should link to a sub-path of the user profile so it is clear to the viewer that they are viewing Issues related to the user.

## Task
All of these tasks should be done in the `accounts` app.

- [ ] create a Django view called `UserIssues` (in `accounts/views.py`)
- [ ] create a URL definition `profile/<str:username>/issues` that renders the `UserIssues` view ( in `accounts/urls.py`)
- [ ] ensure the `UserIssues` view context contains a list of users that are following the relevant user (given via the `username` in the URL) 
    - note, it should be possible to get the issues via `user.issue_civis`
- [ ] create a template to render the user issues - for now, extending `base.html` so we have consistent branding  (in `accounts/templates/accounts/user_civis.html`) 
    - unless the `profile_base.html` is available, in which case use that instead



Discussion:
Can you please assign this issue to me? 

Again, can I put my hand up for next in line? No pressure @8bitaby 

@brylie is it just spam if I put the same comment in the other two similar issues?
Can I be next in line for this issue? I'd like to work on this issue
Sure. Open a pull request when you've got some initial progress 🙂

Resolving patch:
diff --git a/project/accounts/urls.py b/project/accounts/urls.py
--- a/project/accounts/urls.py
+++ b/project/accounts/urls.py
@@ -5,13 +5,14 @@
     PasswordResetView,
     ProfileActivationView,
     ProfileFollow,
+    ProfileFollowing,
     ProfileUnfollow,
     RegisterView,
     SettingsView,
+    UserCivis,
     UserFollowers,
-    ProfileFollowing,
+    UserIssues,
     UserProfileView,
-    UserCivis,
     expunge_user,
 )
 from django.contrib.auth import views as auth_views
@@ -55,6 +56,11 @@
         UserCivis.as_view(),
         name="user-civis",
     ),
+    path(
+        "profile/<str:username>/issues/",
+        UserIssues.as_view(),
+        name="user-issues",
+    ),
     path(
         "accounts/password_reset/",
         PasswordResetView.as_view(),
diff --git a/project/accounts/views.py b/project/accounts/views.py
--- a/project/accounts/views.py
+++ b/project/accounts/views.py
@@ -188,10 +188,9 @@ def get(self, request, username=None):
         )
 
 
-
 class UserFollowers(LoginRequiredMixin, View):
     """A view that shows the followers for authorized users"""
-    
+
     def get(self, request, username=None):
         profile = get_object_or_404(Profile, user__username=username)
 
@@ -215,16 +214,13 @@ def get(self, request, username=None):
 
         return TemplateResponse(
             request,
-
             "profile_following.html",
-
             {
                 "profile": profile,
             },
         )
 
 
-
 class UserCivis(LoginRequiredMixin, View):
     """
     A view that shows list of civis
@@ -243,7 +239,6 @@ def get(self, request, username=None):
         )
 
 
-
 @login_required
 def expunge_user(request):
     """
@@ -276,3 +271,17 @@ def expunge_user(request):
     profile.save()
 
     return redirect("/")
+
+
+class UserIssues(LoginRequiredMixin, View):
+    def get(self, request, username=None):
+        profile = get_object_or_404(Profile, user__username=username)
+        user = profile.user
+        civis = user.civis.all()
+        followers = profile.followers.all()
+
+        return TemplateResponse(
+            request,
+            "user_civis.html",
+            {"profile": profile, "followers": followers, "civis": civis},
+        )


Test patch: