Better to make profile part of user

This is just a general question to find out if my thinking is right. Is it better to have the user profile as a custom model separate from the custom user model or is it better to have the profile as part of the custom user model. I’m just thinking if everything is in one place then it’s easier to get to field values and you do not have to do the extra work of matching users with profiles in order to get something like a user’s profile image when all you have is the user id?

Like for example I have comments on posts and I have to show the user image but all I have is the user id of the person that commented on a post. Now I have to go and do a separate call to get that profile of said user and then get the profile image where if the profile was part of the user model then I can get it far easier.


From a data modelling perspective, there are two factors to consider with this decision, “Control” and “Preponderance of Use”.

The “Control” issue is rather straight forward. Do you have complete control over what is allowed to be in the base model? If not, then it may be necessary to add supplemental data in a related model.

The “Preponderance of Use” is more subjective. That’s a judgement call as to whether you’re going to need that supplemental data frequently enough compared to the base data for it to be worth adding that information to the base model.

This is not an accurate statement. The ORM provides a field allowing you to reference the related object directly, without you needing to write an additional query - and, with appropriate use of the select_related clause, allows the ORM to do this retrieval in one query.

IMHO if you have just one type of profile (all kind of user share the same fields) and yo don’t have lot of fields; it is OK use only a User Model.

If you have different type of profiles, and that profiles don’t share fields you must have a separate Profile Model.

Everything else, between that two options should be analyzed in detail.

Thank you Ken for the detailed explanation. More reading to do, which is the case every time I get an answer from you LOL It’s a good thing trust me!

Thank you sir. I decided to stick with the user profile as a separate model in case i want to later add maybe another type of profile. I appreciate the advice thanks