我正在尝试在我的应用程序模型上使用 manage.py dumpdata 但我无法在我的转储文件中看到 json 数据,因为我正在使用 django-tenant-schemas 应用程序来管理各种客户端的模型。有没有解决与特定模式相关的转储数据的方法?
问问题
1361 次
1 回答
4
我找到了这样做的解决方案: -
python manage.py tenant_command dumpdata --schema="schema-name" app_name.model_name --indent 4 > fixtures/dump.json
或者您可以使用:-
for t in $(./manage.py list_tenants | cut -f1);
do
./manage.py tenant_command dumpdata --schema=$t --indent=2 auth.user > ${t}_users.json;
done
我在这里找到了答案:-
http://django-tenant-schemas.readthedocs.io/en/latest/use.html?highlight=dumpdata
于 2016-12-07T13:17:08.593 回答