#how to create a django user authentication system for different usertypes eg. doctor patient nurse..

5 messages · Page 1 of 1 (latest)

wide hedge
#

how to create a django user authentication system for different usertypes eg. doctor patient nurse..

wide hedge
#

Hi ... What would be right approach to create authentication system for different usertypes.. using djoser and jwt

serene granite
#

I would use the User model mainly for auth and common attributes (name, email, etc...) and create a profile model for each different user type. Each profile should be created with a OneToOne relationship with the user model.

This is assuming they are different enough: a doctor might have "expertises"/"skills" while a patient would have treatments, medical history etc...

In your application, you might want to think about what happens when a user has more then 1 profile: eg a doctor could also be a patient. You could have a profile switcher in the nav bar, for example.

serene granite
#

Using djoser, another lib for auth views or write your own is a bit of an orthogonal decision from how you model your profiles. And using jwt vs session is yet another separate decision.

Each of these 3 decisions are not mutually exclusive, on the contrary, that's more 3 different facets of the user management.

serene granite
#

But keeping your user model close to vanilla Django would probably help integration with other libraries, I think