Skip to content
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
6 changes: 6 additions & 0 deletions project/accounts/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
SettingsView,
ProfileFollowing,
UserProfileView,
UserCivis,
expunge_user,
)
from django.contrib.auth import views as auth_views
Expand Down Expand Up @@ -43,6 +44,11 @@
ProfileFollowing.as_view(),
name="profile-following",
),
path(
"profile/<str:username>/civis/",
UserCivis.as_view(),
name="user-civis",
),
path(
"accounts/password_reset/",
PasswordResetView.as_view(),
Expand Down
18 changes: 18 additions & 0 deletions project/accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,24 @@ def get(self, request, username=None):
)


class UserCivis(LoginRequiredMixin, View):
"""
A view that shows list of civis
that profile with given username created
"""

def get(self, request, username=None):
profile = get_object_or_404(Profile, user__username=username)
user = profile.user
civis = user.civis.all()

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


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