[Answer]-Resolve user type in authentication in Django

1👍

The user.client is exists but user.teacher doesn’t, so you get the error then you access this attribute in the if user.teacher: statement.

Replace it with the something like this:

if Teacher.objects.filter(user=user).exists():
    ...

Leave a comment