Django Rest Framework With Two User Table

I currently working on project that use two user table. One for web admin and another is for mobile app. The web admin is using django contrib user and is already taken care of for authentication. I need some way to get the user for mobile app to get authentication too. How can i make this possible with this scenario. To make our app is save with two user table.

You really don’t want to do that.

You only need and want to have one User table. That’s the reason for the flags and permission system within Django - to avoid having to try and do things like this.

You can also create a custom User with attributes for whatever purposes you need.

But no. Do not implement your system with two user models.

3 Likes

@KenWhitesell
If I still want to use two user models to serve the shared system for different companies and need to separate the database, does Django support this?

I’m not sure I’m following what exactly you’re asking for here.

Regardless, in the general case when using Django’s authentication and authorization facilities, you want one and only one user model.

1 Like

What do you mean by separate database?

Why don’t you try to have multiple users roles based on assigned group or have an extra attribute in your user model.

Role1: Web admin
Role2: Mobile user

Then you can allow Mobile API access only to mobile user role and vise versa if that’s needed

If I were you, I would add one field to the existing user model and then store the device classification. (Web and App)