Mercurial > public > sg101
diff donations/views.py @ 1087:7fb9bc5a1232
Add progress bar to donations page.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Tue, 03 May 2016 21:17:28 -0500 |
parents | 75189bd9c4ba |
children | fbfb1a9c70e2 |
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,