问题:
$ python manage.py dumpdata auth.user
[]
但是我确实有用户:
$ python manage.py shell
Python 3.6.8 (default, Dec 24 2018, 19:24:27)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.contrib.auth.models import User
>>> User.objects.all().count()
3
并且loaddata
可以正常工作:
$ cat user.json
[
{
"model": "auth.user",
"fields": {
"username": "fixture_user"
}
}
]
$ python manage.py loaddata user.json
Installed 1 object(s) from 1 fixture(s)
我的Django版本:
$ pip show Django
Name: Django
Version: 1.11.7
我的数据库是本地PostgreSQL数据库。
我可能做错了什么?