and when i try to access any object of anther model {{user.age}} in template, it is not rendering anything i have passed context in template {{'user ': request.user}}
Is age
an attribute of user
?
no it is object of second model as you can see in the code, i have posted above.
So why do you think that user.age
is going to give you anything?
If you have a reference to your user model named user
, how would you refer to your profile model?
are you telling me to use like ‘related_name’ or something as parameter in onetoone field?
Your models are fine - I’ve already verified that earlier.
Notice that I’m not making any reference to any definitions within the Profile
model.
Read the docs at OneToOneField
If you have a reference to your user model named user
, how would you refer to your profile model ?
i really dont know, i am stcked , i tried by passing another context in template but, nothing happen