def team_specific_greek_candles(request, team): helper = RelayFunctions() all_team_specific_greek_candles = [] teamObject = Team.objects.get(pk = team) companyObject = Company.objects.get(pk = teamObject.company.id) for participant in Participant.objects.filter(team = team): all_team_specific_greek_candles.append(helper.team_specific_greek_candles(model_to_dict(participant)['id'])) newlist = sorted(all_team_specific_greek_candles, key=itemgetter('participant_candles_total'), reverse = True) response = json.dumps(newlist) return HttpResponse(response, mimetype="application/json")