How to access model attriburtes using variables

Suppose there is a model called ExampleModel and it has fields(attributes) named as name and number.
I have made a variable called x = “name” and let obj = ExampleModel.objects.get(id = 1). Now how can I do something like using the variable x.

See the post: Call database field "dynamically"

1 Like

Thank you for your help!