Как объявить изменение значения переменной [дубликат]

Здравствуйте, у меня проблема с присвоением одной изменяющейся переменной другой переменной.

Вот мой код:

model.py
    
class Team_of_4(models.Model):
    name = models.CharField(max_length=64)
    op1 = models.CharField(max_length=16, choices=ARMIES_CHOICE)
    op2 = models.CharField(max_length=16, choices=ARMIES_CHOICE)
    op3 = models.CharField(max_length=16, choices=ARMIES_CHOICE)
    op4 = models.CharField(max_length=16, choices=ARMIES_CHOICE)
    p11 = models.IntegerField(choices=PARING_SCORE_CHOICES)
    p12 = models.IntegerField(choices=PARING_SCORE_CHOICES)
    p13 = models.IntegerField(choices=PARING_SCORE_CHOICES)
    p14 = models.IntegerField(choices=PARING_SCORE_CHOICES)
    p21 = models.IntegerField(choices=PARING_SCORE_CHOICES)
    p22 = models.IntegerField(choices=PARING_SCORE_CHOICES)
    p23 = models.IntegerField(choices=PARING_SCORE_CHOICES)
    p24 = models.IntegerField(choices=PARING_SCORE_CHOICES)
    p31 = models.IntegerField(choices=PARING_SCORE_CHOICES)
    p32 = models.IntegerField(choices=PARING_SCORE_CHOICES)
    p33 = models.IntegerField(choices=PARING_SCORE_CHOICES)
    p34 = models.IntegerField(choices=PARING_SCORE_CHOICES)
    p41 = models.IntegerField(choices=PARING_SCORE_CHOICES)
    p42 = models.IntegerField(choices=PARING_SCORE_CHOICES)
    p43 = models.IntegerField(choices=PARING_SCORE_CHOICES)
    p44 = models.IntegerField(choices=PARING_SCORE_CHOICES)

views.py

class TParing4v4View(View):
    def get(self, request, id, par):
        tournament = Tournaments.objects.get(pk=id)
        player = Team_of_4.objects.get(pk=par)
        result = []
        data_list = []
        points = []
        mp = []
        teamA = [tournament.p1, tournament.p2, tournament.p3, tournament.p4]
        teamB = [player.op1, player.op2, player.op3, player.op4]
        for perm in permutations(teamA):
            result.append(list(zip(perm, teamB)))
        for pairing in result:
            score = []
            total = 0
            for i in pairing:
                for A in teamA:
                    for B in teamB:
                        if i == (A, B):
                            x = teamA.index(A) + 1
                            y = teamB.index(B) + 1
                            j = player.pxy

Как добавить значения x и y к j?

Я хочу получить что-то вроде этого: j = player.p11 j = player.p12 . . . j = player.p44

Вернуться на верх