Show badges on user profile page

This commit is contained in:
Michael Hall 2018-08-25 11:29:30 -04:00
parent a1c387f520
commit 83550b4cf7
2 changed files with 12 additions and 0 deletions

View file

@ -56,6 +56,16 @@
{% endif %}
</div>
<div class="col-md-3">
{% if badges %}
<h4>Badges</h4>
<div class="mb-3">
{% for badge in badges %}
<div class="ml-3 mb-1">
<img class="mr-2 gt-profile-badge" src="{{badge.img_url}}" width="24px" height="24px" align="baseline">{{badge.name}}
</div>
{% endfor %}
</div>
{% endif %}
{% if teams %}
<h4>Teams</h4>
<ul>

View file

@ -65,10 +65,12 @@ def show_profile(request, user_id):
teams = user.memberships.all()
talks = Talk.objects.filter(speaker__user=user)
badges = user.user.account.badges.all()
context = {
'user': user,
'teams': teams,
'talks': talks,
'badges': badges,
}
return render(request, 'get_together/users/show_profile.html', context)