# HG changeset patch # User Brian Neal # Date 1462328248 18000 # Node ID 7fb9bc5a1232cab27779ae0ea821d6f050414f3c # Parent aa43db10c565fb224ecb5945ef585f3a563324ea Add progress bar to donations page. diff -r aa43db10c565 -r 7fb9bc5a1232 donations/views.py --- 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, diff -r aa43db10c565 -r 7fb9bc5a1232 sg101/templates/donations/index.html --- 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 @@ Gross:${{ gross }} Net:${{ net }} Left to Go:${{ left }} + Progress: