File diff 3b4453c2384e → 7c7ab8f6910f
www/conservancy/local_context_processors.py
Show inline comments
 
from datetime import datetime as DateTime
 
from pytz import utc as UTC
 

	
 
import conservancy.settings
 
from conservancy.apps.fundgoal.models import FundraisingGoal as FundraisingGoal
 

	
 
SITE_FUNDGOAL = 'cy2018-end-year-match'
 
# FIXME: Move this information into the model.
 
FUNDGOAL_ENDTIMES = {
 
    # End of 2019-01-15 AOE is 2019-01-16 noon UTC.
 
    'cy2018-end-year-match': DateTime(2019, 1, 16, 12, tzinfo=UTC),
 
}
 

	
 
def fundgoal_lookup(fundraiser_sought):
 
    try:
 
        return FundraisingGoal.objects.get(fundraiser_code_name=fundraiser_sought)
...
 
@@ -9,7 +19,10 @@ def fundgoal_lookup(fundraiser_sought):
 
        return None
 

	
 
def sitefundraiser(request):
 
    return {'sitefundgoal': fundgoal_lookup('cy2018-end-year-match') }
 
    return {
 
        'sitefundgoal': fundgoal_lookup(SITE_FUNDGOAL),
 
        'sitefundgoal_timeleft': FUNDGOAL_ENDTIMES[SITE_FUNDGOAL] - DateTime.now(UTC),
 
    }
 

	
 
if conservancy.settings.FORCE_CANONICAL_HOSTNAME:
 
    _HOST_URL_VAR = {'host_url': 'https://' + conservancy.settings.FORCE_CANONICAL_HOSTNAME}