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
7 changes: 5 additions & 2 deletions project/accounts/templates/accounts/account.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
<img
class="responsive-img"
src={{ profile.profile_image_url }}
/>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected trailing spaces found.


>
</div>
</div>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected trailing spaces found.

<!-- Prevent users from following themselves. -->

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected trailing spaces found.

{% if not profile == request.user.profile %}
{% if profile not in request.user.profile.following.all %}
<a href="{% url 'profile-follow' profile.user.username %}" class="waves-effect waves-light btn follow-btn" id="sidebar-follow-btn">
Expand Down
53 changes: 33 additions & 20 deletions project/accounts/templates/accounts/user_civis.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,40 @@
{% load i18n %}

{% block content %}
{% for civi in civis %}
<div class="civi-card white" data-id="">
<div class="civi-header-account white">
<div class="civi-title-outer">
<div class="civi-type gray-text">{{ civi.c_type }}</div>
<div class="civi-title">{{ civi.title }}</div>
</div>
</div>
<div class="civi-body">
<div class="civi-body-inner">{{ civi.body }}</div>
</div>
{% for civi in civis %}
<div class="civi-card white" data-id="">
<div class="civi-header-account white">
<div class="civi-title-outer">
<div class="civi-type gray-text">{{ civi.c_type }}</div>
<div class="civi-title">{{ civi.title }}</div>
</div>
{% empty %}
<div class="section no-state">
<div class="container">
<div class="section">
<div class="center title-lato text">No activity</div>
</div>
</div>
</div>
<div class="civi-body">
<div class="civi-body-inner">{{ civi.body }}</div>
</div>
</div>
{% empty %}
<div class="section no-state">
<div class="container">
<div class="section">
<div class="center title-lato text">No activity</div>
</div>
{% endfor %}
</div>
</div>
{% endfor %}

{% for follower in followers%}
<div class="col s12 m6">
<div class="user-chip chip white">
<div class="user-chip-contents">
<a href="/profile/{{ follower.user.username }}/">
<img src="{{ follower.profile_image_url }}" alt="{{ followers.user.username }}">
@{{ follower.user.username }}
</a>
</div>
</div>
</div>
{%endfor%}


{% endblock content %}
{% endblock content %}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a newline at the end of the file.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected additional newlines at the end of the file.

10 changes: 8 additions & 2 deletions project/accounts/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(),
Expand Down
20 changes: 14 additions & 6 deletions project/accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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
Expand All @@ -243,7 +239,6 @@ def get(self, request, username=None):
)



@login_required
def expunge_user(request):
"""
Expand Down Expand Up @@ -276,3 +271,16 @@ 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, "user": user, "civis": civis},

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line too long (87 > 79 characters)

)