[Answered ]-How to get attribute of a django model's foreign key object using getattr in python?

2👍

That’s because it tries to fetch property 'y.random', though there is no such property, and it’s not even valid to have a property with ..

getattr(getattr(x, 'y'), 'random'))

Leave a comment