Changeset - ab2239009a1b
[Not reviewed]
0 2 0
Bradley Kuhn (bkuhn) - 9 years ago 2015-03-09 06:40:47
bkuhn@ebb.org
Rework again to see if I can get this corrected.
2 files changed with 14 insertions and 12 deletions:
0 comments (0 inline, 0 general)
www/conservancy/static/views.py
Show inline comments
...
 
@@ -27,2 +27,9 @@ def handler500(request):
 

	
 
def fundgoal_lookup(fundraiser_sought):
 
    try:
 
        return FundraisingGoal.objects.get(fundraiser_code_name=fundraiser_sought)
 
    except FundraisingGoal.DoesNotExist:
 
     # we have no object!  do something
 
        return None
 

	
 
def index(request, *args, **kwargs):
...
 
@@ -39,14 +46,9 @@ def index(request, *args, **kwargs):
 
    template = loader.get_template(path)
 
    context = RequestContext(request, kwargs)
 
    return HttpResponse(template.render(context))
 

	
 
def fundgoal_lookup(fundraiser_sought):
 
    try:
 
        return FundraisingGoal.objects.get(fundraiser_code_name=fundraiser_sought)
 
    except FundraisingGoal.DoesNotExist:
 
     # we have no object!  do something
 
        return None
 
    if kwargs.has_key('fundraiser_sought'):
 
        kwargs = kwargs.copy()
 
        kwargs['fundgoal'] = fundgoal_lookup(kwargs['fundraiser_sought'])
 

	
 
def index_with_fundraiser_data(request, *args, **kwargs):
 
    return index(request, { 'fundgoal' : fundgoal_lookup(kwargs['fundraiser_sought']) })
 
    context = RequestContext(request, kwargs)
 
    return HttpResponse(template.render(context))
 

	
www/conservancy/urls.py
Show inline comments
...
 
@@ -55,6 +55,6 @@ urlpatterns = patterns('',
 
    (r'^donate', 'conservancy.static.views.index'),
 
    (r'^linux-compliance', 'conservancy.static.views.index_with_fundraiser_data',
 
    (r'^linux-compliance', 'conservancy.static.views.index',
 
                           {'fundraiser_sought' : 'vmware-match-0'}),
 
    (r'^members', 'conservancy.static.views.index'),
 
    (r'^npoacct', 'conservancy.static.views.index_with_fundraiser_data',
 
    (r'^npoacct', 'conservancy.static.views.index',
 
                  {'fundraiser_sought' : 'npoacct'}),
0 comments (0 inline, 0 general)