Implement min filter.
This commit is contained in:
		
							parent
							
								
									20d3accd3c
								
							
						
					
					
						commit
						d305f5103f
					
				
					 2 changed files with 11 additions and 2 deletions
				
			
		www/conservancy
							
								
								
									
										8
									
								
								www/conservancy/apps/news/templatetags/min.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								www/conservancy/apps/news/templatetags/min.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,8 @@ | ||||||
|  | from django import template | ||||||
|  | register = template.Library() | ||||||
|  | 
 | ||||||
|  | @register.filter | ||||||
|  | def min(value, arg): | ||||||
|  |     if value > arg: | ||||||
|  |         return arg | ||||||
|  |     return value | ||||||
|  | @ -1,5 +1,7 @@ | ||||||
| {% load humanize %} | {% load humanize %} | ||||||
| {% load subtract %} | {% load subtract %} | ||||||
|  | {% load min %} | ||||||
|  | 
 | ||||||
| <!DOCTYPE html> | <!DOCTYPE html> | ||||||
| 
 | 
 | ||||||
| <html lang="en"> | <html lang="en"> | ||||||
|  | @ -55,8 +57,7 @@ | ||||||
| <a href="/supporter"><div id="siteprogressbar"> | <a href="/supporter"><div id="siteprogressbar"> | ||||||
|     <span id="site-fundraiser-so-far">{{ sitefundgoal.fundraiser_so_far_amount|intcomma }}</span> have joined so far |     <span id="site-fundraiser-so-far">{{ sitefundgoal.fundraiser_so_far_amount|intcomma }}</span> have joined so far | ||||||
| {% if sitefundgoal.fundraiser_donation_count_disclose_threshold > 0 %} | {% if sitefundgoal.fundraiser_donation_count_disclose_threshold > 0 %} | ||||||
| {% if sitefundgoal.fundraiser_donation_count_disclose_threshold < 83 %} |     and match pledges reduced our 2,500 maximum need by <span id="site-fundraiser-match-count">{{ sitefundgoal.fundraiser_donation_count_disclose_threshold|min:83|intcomma }}</span> | ||||||
|     and match pledges reduced our 2,500 maximum need by <span id="site-fundraiser-match-count">{{ sitefundgoal.fundraiser_donation_count_disclose_threshold|intcomma }}</span> |  | ||||||
| {% endif %} | {% endif %} | ||||||
| {% endif %} | {% endif %} | ||||||
| !</div></a> | !</div></a> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Bradley M. Kuhn
						Bradley M. Kuhn