Changeset - 8df76219f804
[Not reviewed]
0 1 0
Bradley Kuhn (bkuhn) - 9 years ago 2015-05-10 00:29:08
bkuhn@ebb.org
Get an empty dict & no error when attrs not there
1 file changed with 4 insertions and 1 deletions:
0 comments (0 inline, 0 general)
www/conservancy/apps/fundgoal/views.py
Show inline comments
...
 
@@ -11,9 +11,12 @@ def view(request):
 
    GET = request.GET
 
    codeNames =  []
 
    if 'code_name' in GET: codeNames += GET.getlist('code_name')
 

	
 
    returnDict = {}
 
    for code in FundraisingGoal.objects.filter(fundraiser_code_name__in=codeNames):
 
        returnDict[code] = {}
 
        for kk in keysForJSON:
 
            returnDict[code][kk] = getattr(code, kk)
 
            if hasattr(code, kk):
 
                returnDict[code][kk] = getattr(code, kk)
 

	
 
    return JsonResponse( returnDict)
0 comments (0 inline, 0 general)