1👍
✅
You say you want to use Django’s ORM, but then say you want to do something diametrically opposed to that, ie accessing the cost as x.cost
.
Django will not let you do that, since it completely breaks the object model. cost
is an attribute on the AppCosts model, not the Costs one. If it’s really bothering you, you could add a property
on Costs which returns self.appcosts.cost
, which will do what you want as long as you don’t try to use it in queries.
Source:stackexchange.com