Function to compute how far to the goal we are.
This is also inserted by the Javascript code as well, but no reason we can't compute it server side, too.
This commit is contained in:
		
							parent
							
								
									eb18c15f66
								
							
						
					
					
						commit
						027964192a
					
				
					 2 changed files with 7 additions and 3 deletions
				
			
		|  | @ -10,5 +10,8 @@ class FundraisingGoal(models.Model): | |||
|     def __unicode__(self): | ||||
|         return self.fundraiser_code_name | ||||
| 
 | ||||
|     def percentage_there(self): | ||||
|         return (fundraiser_so_far_amount / fundraiser_goal_amount ) * 100.00 | ||||
|      | ||||
|     class Meta: | ||||
|         ordering = ('fundraiser_code_name',) | ||||
|  |  | |||
|  | @ -136,9 +136,10 @@ el.attachEvent('on'+ev, function() {handler.apply(el);}); | |||
| */ | ||||
| </script> | ||||
| --> | ||||
| ${{ fundgoal.fundraiser_so_far_amount|floatformat:2|intcomma }} raised toward<br/> | ||||
| our ${{ fundgoal.fundraiser_goal_amount|floatformat:2|intcomma  }} goal.<br/> | ||||
| <div id="progressbar"><span style="float:right; align:center; margin-right:40%">88.4%</span></div> | ||||
| ${{ fundgoal.fundraiser_so_far_amount|floatformat:0|intcomma }} raised toward<br/> | ||||
| our ${{ fundgoal.fundraiser_goal_amount|floatformat:0|intcomma  }} goal.<br/> | ||||
| <div id="progressbar"><span style="float:right; align:center; | ||||
|                                    margin-right:40%">{{ fundgoal.percentage_there|floatformat:1 }}%</span></div> | ||||
| <p style="font-size: 75%">(Progress bar updated monthly.)</p> | ||||
| <a id="donate" style="text-decoration:none"></a> | ||||
| <h3>Help us reach our goal:</h3> | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Bradley M. Kuhn
						Bradley M. Kuhn