Best way to work with multiple user profiles


How should i be handling User profiles in my App. At the moment i have a profile model with FKs and MTM relationships to other models and then based on what is within the model linked to the profile I present the data.

For example, I have a dashboard that presents the products a user has and allows the user to add products to their account, etc. But the problem i am facing is that some of my views required data to within models to be able to render the template.

So for these cases, I am wrapping in a try block and passing a default value

So is this the correct way to provide a multiple-user app or is there a library that I should be using?


It’s hard to know if there’s anything to be suggested from an architecture perspective without more information about your models, those views and how you’d like the system to ideally operate.

This does sound like a good job for a decorator. You can look at login_required's implementation to see how Django handles that case.