def new_matches(match, index, tournament): new_match = Match() if match: new_match.next_match = match new_match.start_position = index new_match.turnaj = tournament index -= 1 new_match.save() if index > 0: new_matches(new_match, index, tournament) new_matches(new_match, index, tournament)