1👍
✅
You an use the izip_longest()
function from itertools
:
from itertools import izip_longest
players = izip_longest(game.players_a.all(), game.players_b.all())
return render(request, 'template.html', {'game': game, 'players': players})
Source:stackexchange.com