Models - Problems in using a list with models

Hello i was wondering if there is a way to do the next thing

from .models import Peso
list = ["x","y"]
new = Peso()
new.list[0] = list[1]

When i try to do this the model seach literally the world list[0] instead of “x”. Any ideas?
(Sorry for the bad english)

Use

setattr(new, list[0], list[1])
1 Like