website/conservancy/context_processors.py

19 lines
612 B
Python
Raw Normal View History

from django.conf import settings
from .fundgoal.models import FundraisingGoal
def sitefundraiser(request):
try:
fundgoal0 = FundraisingGoal.objects.get(fundraiser_code_name=settings.SITE_FUNDGOAL_0)
except FundraisingGoal.DoesNotExist:
fundgoal0 = None
try:
fundgoal1 = FundraisingGoal.objects.get(fundraiser_code_name=settings.SITE_FUNDGOAL_1)
except FundraisingGoal.DoesNotExist:
fundgoal1 = None
return {'sitefundgoal0': fundgoal0, 'sitefundgoal1': fundgoal1 }
def host_url(request):
return {'host_url': request.build_absolute_uri('/').rstrip('/')}