[Fixed]-Multiple users in django

1👍

request.user will always return MyUser instance.

Add the following attribute in MyUser –

 TYPES_OF_USERS = (("A", "USER1"), ("B", "USER2"))
 user_type = models.Charfield(max_length=1, choices=TYPES_OF_USERS)

Then, use this code

if request.user.user_type == "A":
      foo = request.user.User1.profile_pic
else:
      foo = request.user.User1.avatar

As an additional note- Since mobile is common to both models, store it in the main MyUser model.

Leave a comment