I'm trying to figure out how to generate a competition chart list from users (players) in database.
I'v got a random sorting:
def shotokanRandPlayers(request, tournament_id): tournament = Tournament.objects.get(id = tournament_id) categories = Category.objects.filter(tournament_id = tournament) for category in categories: if category.type=="KM" and category.playerT_id.all().count()>0: playersT = list(category.playerT_id.all()) random.shuffle(playersT) i = 0 while i<len(playersT): first = FirstPlayer.objects.create(player = playersT[i].player_id) i=i+1 if i<len(playersT): second = SecondPlayer.objects.create(player = playersT[i].player_id) else: second = None Fight.objects.create(category_id = category, firstplayer = first, secondplayer = second, round = 0) i=i+1 return redirect('tournament', tournament_id = tournament.id)
By now on I would like go generate a ready list of these players to have it looked like this:
Are there any django-ready-extensions that would make it ? Or anybody has an idea how to make it ? Thanks!