use history table for club detail view

This commit is contained in:
Pierre-antoine Comby 2019-08-15 23:11:52 +02:00
parent be8f2dc35b
commit 3bda5576dd
2 changed files with 5 additions and 4 deletions

View File

@ -18,7 +18,7 @@ from .models import Profile, Club, Membership
from .forms import ProfileForm, ClubForm,MembershipForm, MemberFormSet,FormSetHelper
from .tables import ClubTable
from note.models.transactions import Transaction
from note.tables import HistoryTable
class UserCreateView(CreateView):
"""
Une vue pour inscrire un utilisateur et lui créer un profile
@ -87,10 +87,10 @@ class ClubDetailView(LoginRequiredMixin,DetailView):
club = context["club"]
club_transactions = \
Transaction.objects.all().filter(Q(source=club.note) | Q(destination=club.note))
context['history_list'] = club_transactions
context['history_list'] = HistoryTable(club_transactions)
club_member = \
Membership.objects.all().filter(club=club)
#TODO: consider only valid Membership
# TODO: consider only valid Membership
context['member_list'] = club_member
return context

View File

@ -2,6 +2,7 @@
{% load static %}
{% load i18n %}
{% load render_table from django_tables2 %}
{% load pretty_money %}
{% block content %}
<p><a class="btn btn-primary" href="{% url 'member:club_list' %}">Clubs</a></p>
<h3 class="text-center"> Club {{ object.name }}</h3>
@ -15,7 +16,7 @@
<dt> Aliases </dt>
<dd>{{ club.note.aliases_set.all }}</dd>
<dt>{% trans 'balance' %}</dt>
<dd>{{ club.note.balance }}</dd>
<dd>{{ club.note.balance | pretty_money }}</dd>
</dl>