This commit is contained in:
Pierre-antoine Comby 2020-02-25 22:55:27 +01:00
parent eb6f142bf8
commit 707770a5b4
3 changed files with 13 additions and 12 deletions

View File

@ -114,12 +114,13 @@ class UserDetailView(LoginRequiredMixin, DetailView):
"""
Affiche les informations sur un utilisateur, sa note, ses clubs...
"""
model = Profile
context_object_name = "profile"
model = User
context_object_name = "user_object"
template_name = "member/profile_detail.html"
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
user = context['profile'].user
user = context['user_object']
history_list = \
Transaction.objects.all().filter(Q(source=user.note) | Q(destination=user.note))
context['history_list'] = HistoryTable(history_list)

View File

@ -87,7 +87,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
</a>
<div class="dropdown-menu dropdown-menu-right"
aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item" href="{% url 'member:user_detail' pk=user.profile.pk %}">
<a class="dropdown-item" href="{% url 'member:user_detail' pk=user.pk %}">
<i class="fa fa-user"></i> Mon compte
</a>
<a class="dropdown-item" href="{% url 'logout' %}">

View File

@ -5,14 +5,14 @@
<div class="row mt-4">
<div class="col-md-3 mb-4">
<div class="card bg-light shadow">
<img src="{{ object.note.display_image.url }}" class="card-img-top" alt="">
<img src="{{ object.note.display_image }}" class="card-img-top" alt="">
<div class="card-body">
<dl class="row">
<dt class="col-xl-6">{% trans 'name'|capfirst %}, {% trans 'first name' %}</dt>
<dd class="col-xl-6">{{ object.user.last_name }} {{ object.user.first_name }}</dd>
<dd class="col-xl-6">{{ object.last_name }} {{ object.first_name }}</dd>
<dt class="col-xl-6">{% trans 'username'|capfirst %}</dt>
<dd class="col-xl-6">{{ object.user.username }}</dd>
<dd class="col-xl-6">{{ user.username }}</dd>
<dt class="col-xl-6">{% trans 'password'|capfirst %}</dt>
<dd class="col-xl-6">
@ -22,19 +22,19 @@
</dd>
<dt class="col-xl-6">{% trans 'section'|capfirst %}</dt>
<dd class="col-xl-6">{{ object.section }}</dd>
<dd class="col-xl-6">{{ object.profile.section }}</dd>
<dt class="col-xl-6">{% trans 'address'|capfirst %}</dt>
<dd class="col-xl-6">{{ object.address }}</dd>
<dd class="col-xl-6">{{ object.profile.address }}</dd>
<dt class="col-xl-6">{% trans 'balance'|capfirst %}</dt>
<dd class="col-xl-6">{{ object.user.note.balance | pretty_money }}</dd>
<dd class="col-xl-6">{{ object.note.balance | pretty_money }}</dd>
<dt class="col-xl-6">{% trans 'aliases'|capfirst %}</dt>
<dd class="col-xl-6">{{ object.user.note.alias_set.all|join:", " }}</dd>
<dd class="col-xl-6">{{ object.note.alias_set.all|join:", " }}</dd>
</dl>
{% if object.user.pk == user.pk %}
{% if object.pk == user.pk %}
<a class="small" href="{% url 'member:auth_token' %}">{% trans 'Manage auth token' %}</a>
{% endif %}
</div>