diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2008-11-24 20:42:09 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2008-11-24 20:42:09 +0000 |
| commit | 089ab18c025917f38a2e3731ae4024d4810df1ec (patch) | |
| tree | 44d41a7f8a72a900d2d723791b6a93bad5825a2a /docs/ref/django-admin.txt | |
| parent | 436a808ce2df380fc9d4e2b5e601ac8ac2f61320 (diff) | |
Fixed #4924: added support for loading compressed fixtures. Thanks to Lars Yencken and Jeremy Dunck.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9527 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/ref/django-admin.txt')
| -rw-r--r-- | docs/ref/django-admin.txt | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/docs/ref/django-admin.txt b/docs/ref/django-admin.txt index 13b591e1bb..357e22b1a5 100644 --- a/docs/ref/django-admin.txt +++ b/docs/ref/django-admin.txt @@ -290,6 +290,9 @@ loaddata <fixture fixture ...> Searches for and loads the contents of the named fixture into the database. +What's a "fixture"? +~~~~~~~~~~~~~~~~~~~ + A *fixture* is a collection of files that contain the serialized contents of the database. Each fixture has a unique name, and the files that comprise the fixture can be distributed over multiple directories, in multiple applications. @@ -309,21 +312,17 @@ will be loaded. For example:: django-admin.py loaddata mydata.json would only load JSON fixtures called ``mydata``. The fixture extension -must correspond to the registered name of a serializer (e.g., ``json`` or -``xml``). +must correspond to the registered name of a +:ref:`serializer <serialization-formats>` (e.g., ``json`` or ``xml``). -If you omit the extension, Django will search all available fixture types +If you omit the extensions, Django will search all available fixture types for a matching fixture. For example:: django-admin.py loaddata mydata would look for any fixture of any fixture type called ``mydata``. If a fixture directory contained ``mydata.json``, that fixture would be loaded -as a JSON fixture. However, if two fixtures with the same name but different -fixture type are discovered (for example, if ``mydata.json`` and -``mydata.xml`` were found in the same fixture directory), fixture -installation will be aborted, and any data installed in the call to -``loaddata`` will be removed from the database. +as a JSON fixture. The fixtures that are named can include directory components. These directories will be included in the search path. For example:: @@ -342,6 +341,23 @@ end of the transaction. The ``dumpdata`` command can be used to generate input for ``loaddata``. +Compressed fixtures +~~~~~~~~~~~~~~~~~~~ + +Fixtures may be compressed in ``zip``, ``gz``, or ``bz2`` format. For example:: + + django-admin.py loaddata mydata.json + +would look for any of ``mydata.json``, ``mydata.json.zip``, +``mydata.json.gz``, or ``mydata.json.bz2``. The first file contained within a +zip-compressed archive is used. + +Note that if two fixtures with the same name but different +fixture type are discovered (for example, if ``mydata.json`` and +``mydata.xml.gz`` were found in the same fixture directory), fixture +installation will be aborted, and any data installed in the call to +``loaddata`` will be removed from the database. + .. admonition:: MySQL and Fixtures Unfortunately, MySQL isn't capable of completely supporting all the |
