Mercurial > public > sg101
changeset 1087:7fb9bc5a1232
Add progress bar to donations page.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Tue, 03 May 2016 21:17:28 -0500 |
parents | aa43db10c565 |
children | 360067908b35 |
files | donations/views.py sg101/templates/donations/index.html |
diffstat | 2 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/donations/views.py Tue May 03 20:58:15 2016 -0500 +++ b/donations/views.py Tue May 03 21:17:28 2016 -0500 @@ -57,14 +57,18 @@ def index(request): gross, net, donations = Donation.objects.monthly_stats() + goal = settings.DONATIONS_GOAL current_site = Site.objects.get_current() form_action, business = paypal_params() + pct = max(0, min(100, int(net / goal * 100))) + return render(request, 'donations/index.html', { - 'goal': settings.DONATIONS_GOAL, + 'goal': goal, 'gross': gross, 'net': net, 'left': settings.DONATIONS_GOAL - net, + 'pct': pct, 'donations': donations, 'form_action': form_action, 'business': business,
--- a/sg101/templates/donations/index.html Tue May 03 20:58:15 2016 -0500 +++ b/sg101/templates/donations/index.html Tue May 03 21:17:28 2016 -0500 @@ -82,6 +82,7 @@ <tr><th>Gross:</th><td>${{ gross }}</td></tr> <tr><th>Net:</th><td>${{ net }}</td></tr> <tr><th>Left to Go:</th><td>${{ left }}</td></tr> + <tr><th>Progress:</th><td><progress max="100" value="{{ pct }}"></progress></td></tr> </table> </div> </div>