无法转储django.contrib.auth的装置。为什么`python manage.py dumpdata auth`返回一个空列表?

时间:2019-01-28 13:41:04

标签: python django django-authentication

问题:

$ 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数据库。

我可能做错了什么?

0 个答案:

没有答案
相关问题