def report(request):
    query = json.loads(request.body)
print(query)
""" [{u'value': u'name', u'key': u'Club'}, {u'value': u'fname', u'key': u'Coach'}, {u'value': u'lname', u'key': u'Coach'}, {u'value': u'fname', u'key': u'Player'},  {u'value': u'league', u'key': u'Participation'}]"""
clubs = Club.objects.all()
result = {}
for index, club in enumerate(clubs):
    coach_fname = club.coach_set.all().values_list('fname', flat=True)
player_fname = club.player_set.all().values_list('fname', flat=True)
player_lname = club.player_set.all().values_list('lname', flat=True)
participation_leage = club.participation_set.all().values_list('league')
out_put = []
club_details = {'club.name': club.name}
coach_details = {'coach': {'coach.fname': list(coach_fname)}}
player_details = {'player': [{'player.fname': list(player_fname)}, {
    'player.lname': list(player_lname)}]}
participation_details = {'participation': [{'participation.league': list(
    participation_leage)}]}
out_put.append(club_details)
out_put.append(coach_details)
out_put.append(player_details)
out_put.append(participation_details)
result.update({['datarow{}'.format(index)]['Club']: out_put})
return HttpResponse(json.dumps(result))
Django — создание отчетов Excel на основе полей модели