Include blank data in CustomUser Model or add a UserProfile model?

I am making a simple app with Django REST Framework and it involves a basic user sign up with email/password.

However, once a person creates an account, they are prompted to create a profile where they add their age, gender, and a short bio.

Should I have the age/gender/bio be part of the CustomUser model, and just leave these fields blank at sign up, but then have the user update the model when they add this info later?

Or should I create an additional “UserProfile” model with a OneToOneField relationship with the CustomUser?

Is there a “best practice” in this area, or can I just do it either way? Any downsides to the first approach?

Thanks guys!

What I have mostly seen as comments regarding this is that it’s better to do the UserProfile method when you can, Custom User model when you must. (With the understanding that this is a general guideline and your mileage may vary, and that there are other factors that might affect your decision.)

The User model is probably going to be your most frequently accessed model, since it gets attached to the request for every request. There’s something to be said for making it as lightweight as possible. On the other hand, the user profile type data you’re mentioning is probably needed much less frequently. So it’s assumed that there’s a performance / load benefit by not needing to get that data all the time.

There are times when it does make sense to create a custom user model. We have a system that has a very complex set of authorization requirements per object - it needs to be processed for every request to determine whether or not the user has access (and type of access) to that object, and some of the attributes needed to do that are associated with the user. In that case, we need that extra data with every request, and so made the determination that we’re better off not having an associated profile model.

2 Likes

That makes sense! No point in having unneeded info in every request. Thanks Ken.