[Solved]-Type object 'User' has no attribute 'objects django

35👍

I just hit the same error with Token not User.

You need to add ‘rest_framework.authtoken’ to your INSTALLED_APPS
And don’t forget to manage.py migrate afterward.

That fixed it for me.

2👍

I just got the same error and added the following lines into settings.py file.

SIMPLE_JWT = {
    'ROTATE_REFRESH_TOKENS': False,
    'BLACKLIST_AFTER_ROTATION': False,
    'UPDATE_LAST_LOGIN': False,
}

Alse added the following line into settings.py file.

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'corsheaders',
    'rest_framework',
    'rest_framework.authtoken',
    'rest_framework_simplejwt' #new line
]

Also run this command: python manage.py migrate
Now, it’s working.

0👍

I used this and it worked for me

python manage.py migrate

👤hamed

0👍

check this code

    objects = MyUserManager()

NO object=…

Leave a comment