Re: how to get a model's field var the field's name in a string?

2009-01-15 Thread bruno desthuilliers
On 15 jan, 09:11, fallhunter wrote: > i mean > i have a model m, and m has a field fd. > so i can wrote like >    xx = m.fd >    m.fd = xxx I assume you mean "I have a model *instance* m". > but, when i got a string  s = "fd" > > how could i do the same as above? As usual in Python: use getatt

how to get a model's field var the field's name in a string?

2009-01-15 Thread fallhunter
i mean i have a model m, and m has a field fd. so i can wrote like xx = m.fd m.fd = xxx but, when i got a string s = "fd" how could i do the same as above? i've tried m.__dict__[s], but it seems read only thanks for any help... --~--~-~--~~~---~--~~ You