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():
...
Source:stackexchange.com