Due to lack of knowledge, when faced with the need to store additional information about users, I created additional UserInfo
model and referenced it by foreign key to the standard User
model.
I have since learned two things:
I would like to understand:
UserInfo
are not used for authentication, is there any reason to merge those into the user model?If the UserInfo
model is not required for authentication, then there's no need to create a completely custom User
model.
What you're currently doing is fine.
But instead of using ForeignKey
, use OneToOneField
so that one UserInfo
instance is tied to one and only one User
instance.
This method is also shown in the documentation: https://docs.djangoproject.com/en/5.0/topics/auth/customizing/#extending-the-existing-user-model.