新建了个app:account。account下models.py中写了自己的MyUser模块.
我现在要查询这个MyUser模块中的用户,如何查询?
系统默认的user的话:
from django.contrib.auth.models import User
User.objects.all()
我现在改成
AUTH_USER_MODEL = 'account.MyUser'
后,如何查询所有用户呢?
我看官网上有这么句话:
Instead of referring to User directly, you should reference the user model using django.contrib.auth.get_user_model().
我尝试
from django.contrib.auth.get_user_model() import MyUser
报错:SyntaxError: invalid syntax