From 81d40a4d1bf60983e8c45722a6c05d680448762b Mon Sep 17 00:00:00 2001 From: Brad Campbell Date: Sun, 15 May 2016 03:03:52 -0400 Subject: [PATCH] add transactions to pools in user admin fixes #190 --- chezbetty/templates/admin/pool.jinja2 | 42 ++++++++++++++++++++++++++- chezbetty/views_admin.py | 8 ++++- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/chezbetty/templates/admin/pool.jinja2 b/chezbetty/templates/admin/pool.jinja2 index ef03720..94e6592 100644 --- a/chezbetty/templates/admin/pool.jinja2 +++ b/chezbetty/templates/admin/pool.jinja2 @@ -37,7 +37,7 @@ {% for pu in pool.users %} - + {{ pu.user|make_link|safe }} {{ button.onoff_switch('pool_user', 'enabled', pu.id, pu.enabled) }} @@ -74,4 +74,44 @@ +
+
+

Transaction History

+
+
+ + + + + + + + + + + + + + {% for event in events %} + + + + + + + + + {% endfor %} + +
DateTypeAmount
{{ button.event(event.id) }}{{ event.timestamp|pretty_date|safe }}{{ event.type }}{{ event.transactions[0].amount|format_currency|safe }}
+ + {% if events_total %} + + Displaying 1-{{ events|length }} of {{ events_total }}. Click to show all.

+
+ {% endif %} + +
+
+ {% endblock %} diff --git a/chezbetty/views_admin.py b/chezbetty/views_admin.py index 58ee068..7cc7d29 100644 --- a/chezbetty/views_admin.py +++ b/chezbetty/views_admin.py @@ -2327,9 +2327,15 @@ def admin_pools(request): def admin_pool(request): try: pool = Pool.from_id(request.matchdict['pool_id']) + + events, events_total = limitable_request( + request, pool.get_events, prefix='event', limit=10, count=True) + return {'pool': pool, 'pool_owner': User.from_id(pool.owner), - 'users': User.all()} + 'users': User.all(), + 'events': events, + 'events_total': events_total} except Exception as e: if request.debug: raise(e) request.session.flash('Unable to find pool.', 'error')