From be8f2dc35bb4b9b3c1fc1a2bac6541727c016c0a Mon Sep 17 00:00:00 2001 From: Pierre-antoine Comby Date: Thu, 15 Aug 2019 23:11:16 +0200 Subject: [PATCH] use accordion + history table for profil view --- apps/member/views.py | 14 ++++++---- templates/member/profile_detail.html | 40 +++++++++++++++++++++++++--- 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/apps/member/views.py b/apps/member/views.py index f54103e7..487da98b 100644 --- a/apps/member/views.py +++ b/apps/member/views.py @@ -47,13 +47,17 @@ class UserCreateView(CreateView): class UserDetailView(LoginRequiredMixin,DetailView): model = Profile - + context_object_name = "profile" def get_context_data(slef,**kwargs): context = super().get_context_data(**kwargs) - user = context['object'].user.note - user_transactions = \ - Transaction.objects.all().filter(Q(source=user) | Q(destination=user)) - context['history_list'] = user_transactions + user = context['profile'].user + + history_list = \ + Transaction.objects.all().filter(Q(source=user.note) | Q(destination=user.note)) + context['history_list'] = HistoryTable(history_list) + club_list = \ + Membership.objects.all().filter(user=user).only("club") + context['club_list'] = ClubTable(club_list) return context diff --git a/templates/member/profile_detail.html b/templates/member/profile_detail.html index 82be255a..fd5ebd7f 100644 --- a/templates/member/profile_detail.html +++ b/templates/member/profile_detail.html @@ -23,7 +23,41 @@
{{ object.user.note.balance | pretty_money }}
- {% trans 'Change password' %} + {% trans 'Change password' %} - {% render_table history_list %} -{% endblock %} +
+
+
+
+ +
+
+ +
+
+ {% render_table club_list %} +
+
+
+
+
+
+ +
+
+
+
+ {% render_table history_list %} +
+
+
+
+ + + + + {% endblock %}