summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorPavel Kulikov <kulikovpavel@gmail.com>2017-03-26 22:29:05 +0300
committerTim Graham <timograham@gmail.com>2017-05-26 19:54:21 -0400
commitaf1fa5e7da21c57a4037e67f93493af4e78d454a (patch)
tree459e2342f0431a83f9915dffee09cf89fa54bc16 /docs
parentc930c241f8f1ccf3a7848b843628eacdb983d70a (diff)
Fixed #27978 -- Allowed loaddata to read data from stdin.
Thanks Squareweave for the django-loaddata-stdin project from which this is adapted.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/django-admin.txt29
-rw-r--r--docs/releases/2.0.txt2
2 files changed, 31 insertions, 0 deletions
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 <serialization-formats>` (e.g.,
+``json`` or ``xml``) for fixtures :ref:`read from stdin
+<loading-fixtures-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 <loaddata --format>` option
+is required to specify the :ref:`serialization format <serialization-formats>`
+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``
----------------
diff --git a/docs/releases/2.0.txt b/docs/releases/2.0.txt
index 186f64319d..de5b38a098 100644
--- a/docs/releases/2.0.txt
+++ b/docs/releases/2.0.txt
@@ -185,6 +185,8 @@ Management Commands
* The new :option:`makemessages --add-location` option controls the comment
format in PO files.
+* :djadmin:`loaddata` can now :ref:`read from stdin <loading-fixtures-stdin>`.
+
Migrations
~~~~~~~~~~