From af1fa5e7da21c57a4037e67f93493af4e78d454a Mon Sep 17 00:00:00 2001 From: Pavel Kulikov Date: Sun, 26 Mar 2017 22:29:05 +0300 Subject: Fixed #27978 -- Allowed loaddata to read data from stdin. Thanks Squareweave for the django-loaddata-stdin project from which this is adapted. --- docs/ref/django-admin.txt | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'docs/ref') diff --git a/docs/ref/django-admin.txt b/docs/ref/django-admin.txt index 2de0ab6a8b..68fb762623 100644 --- a/docs/ref/django-admin.txt +++ b/docs/ref/django-admin.txt @@ -416,6 +416,14 @@ originally generated. Specifies a single app to look for fixtures in rather than looking in all apps. +.. django-admin-option:: --format FORMAT + +.. versionadded:: 2.0 + +Specifies the :ref:`serialization format ` (e.g., +``json`` or ``xml``) for fixtures :ref:`read from stdin +`. + .. django-admin-option:: --exclude EXCLUDE, -e EXCLUDE .. versionadded:: 1.11 @@ -552,6 +560,27 @@ defined, name the fixture ``mydata.master.json`` or ``mydata.master.json.gz`` and the fixture will only be loaded when you specify you want to load data into the ``master`` database. +.. _loading-fixtures-stdin: + +Loading fixtures from ``stdin`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 2.0 + +You can use a dash as the fixture name to load input from ``sys.stdin``. For +example:: + + django-admin loaddata --format=json - + +When reading from ``stdin``, the :option:`--format ` option +is required to specify the :ref:`serialization format ` +of the input (e.g., ``json`` or ``xml``). + +Loading from ``stdin`` is useful with standard input and output redirections. +For example:: + + django-admin dumpdata --format=json --database=test app_label.ModelName | django-admin loaddata --format=json --database=prod - + ``makemessages`` ---------------- -- cgit v1.3