1đź‘Ť
âś…
But this isn’t “extending the user model” at all. You have a reference to a completely different model, via a ForeignKey. I don’t know why you’d expect favorite_color
to suddenly become an attribute on the User model.
Instead of a ForeignKey (which implies many ExtendedUsers for each User), use a OneToOneField
. Then you can follow the relationship directly:
user = User.objects.get(pk=1)
print user.extendeduser.favorite_color
👤Daniel Roseman
Source:stackexchange.com