~ubuntu-branches/ubuntu/quantal/python-django/quantal-security

« back to all changes in this revision

Viewing changes to docs/howto/initial-data.txt

  • Committer: Bazaar Package Importer
  • Author(s): Jamie Strandboge
  • Date: 2010-10-12 11:34:35 UTC
  • mfrom: (1.2.7 upstream)
  • mto: This revision was merged to the branch mainline in revision 30.
  • Revision ID: james.westby@ubuntu.com-20101012113435-9lnsrh0i3mxozbt0
Tags: upstream-1.2.3
ImportĀ upstreamĀ versionĀ 1.2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
.. _howto-initial-data:
2
 
 
3
1
=================================
4
2
Providing initial data for models
5
3
=================================
20
18
 
21
19
A fixture is a collection of data that Django knows how to import into a
22
20
database. The most straightforward way of creating a fixture if you've already
23
 
got some data is to use the :djadmin:`manage.py dumpdata` command. Or, you can
24
 
write fixtures by hand; fixtures can be written as XML, YAML, or JSON documents.
25
 
The :ref:`serialization documentation <topics-serialization>` has more details
26
 
about each of these supported :ref:`serialization formats
 
21
got some data is to use the :djadmin:`manage.py dumpdata <dumpdata>` command.
 
22
Or, you can write fixtures by hand; fixtures can be written as XML, YAML, or
 
23
JSON documents. The :doc:`serialization documentation </topics/serialization>`
 
24
has more details about each of these supported :ref:`serialization formats
27
25
<serialization-formats>`.
28
26
 
29
27
As an example, though, here's what a fixture for a simple ``Person`` model might
114
112
``INSERT`` statements separated by semicolons).
115
113
 
116
114
The SQL files are read by the :djadmin:`sqlcustom`, :djadmin:`sqlreset`,
117
 
:djadmin:`sqlall` and :djadmin:`reset` commands in :ref:`manage.py
118
 
<ref-django-admin>`. Refer to the :ref:`manage.py documentation
119
 
<ref-django-admin>` for more information.
 
115
:djadmin:`sqlall` and :djadmin:`reset` commands in :doc:`manage.py
 
116
</ref/django-admin>`. Refer to the :doc:`manage.py documentation
 
117
</ref/django-admin>` for more information.
120
118
 
121
119
Note that if you have multiple SQL data files, there's no guarantee of
122
120
the order in which they're executed. The only thing you can assume is