Correct keys to be the code name of the fundraiser

This commit is contained in:
Bradley M. Kuhn 2015-05-09 17:31:47 -07:00
parent 8df76219f8
commit 4d4f520900

View file

@ -13,10 +13,11 @@ def view(request):
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 fundGoal in FundraisingGoal.objects.filter(fundraiser_code_name__in=codeNames):
codeName = fundGoal.fundraiser_code_name
returnDict[codeName] = {}
for kk in keysForJSON:
if hasattr(code, kk):
returnDict[code][kk] = getattr(code, kk)
if hasattr(codeName, kk):
returnDict[codeName][kk] = getattr(codeName, kk)
return JsonResponse( returnDict)