我使用rest_framework_social_oauth2OAuth2用戶自定義的用戶基本模型
我想在oauth.User變化最小。搜索以通過AbstractUser交換AbstractBaseUser並添加PermissionMixin。但沒有任何工作。
我的應用程序>models.py:
from django.db import models
from django.contrib.auth.models import AbstractUser, PermissionsMixin, UserManager
class MyUser(AbstractUser, PermissionsMixin):
country_code = models.CharField(max_length=10, blank=True)
objects = UserManager()
我settings.py:
AUTH_USER_MODEL ='userTest.MyUser'
如圖所示的教程,而不是做makemigrations和遷移。
ERRO:
File "/Users/luisdemarchi/Git/django/.env/lib/python3.5/site-packages/django/db/models/manager.py", line 277, in get self.model._meta.swapped,
AttributeError: Manager isn't available; 'auth.User' has been swapped for 'userTest.MyUser'