summaryrefslogtreecommitdiff
path: root/docs/model-api.txt
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2006-05-19 03:37:50 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2006-05-19 03:37:50 +0000
commit21dd8e272b50c6aba1a08e14ab232b10dcb6e8db (patch)
treea1970df09987ae7a18bef81b115d69021036aa7e /docs/model-api.txt
parent026d8c6f0827164c58ea0284966ae46e4c1c279d (diff)
Fixed #981 -- documented the SQL initial data insert files.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2942 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/model-api.txt')
-rw-r--r--docs/model-api.txt18
1 files changed, 18 insertions, 0 deletions
diff --git a/docs/model-api.txt b/docs/model-api.txt
index 6d6249ee88..de971f7e74 100644
--- a/docs/model-api.txt
+++ b/docs/model-api.txt
@@ -1631,3 +1631,21 @@ read, in part::
'mysite.myapp',
#...
)
+
+Seeding models with initial data
+================================
+
+Sometimes, once the database tables for a model are created, you will want to
+populate them with some default records or perhaps some testing data. For each
+model you have like this, create a file named after the lower-cased version of
+the model's name, with an extension of ``.sql``. Put this file in a directory
+called ``sql/`` under your application directory (so, ``myapp/sql/poll.sql``
+for ``Poll`` model in the ``myapp`` application).
+
+This file should contain valid SQL statements that can be executed to create
+the initial data you would like to insert. These files are read by the
+``sqlinitialdata``, ``sqlreset``, ``sqlall`` and ``reset`` commands in
+``manage.py``. Refer to the `manage.py documentation`_ for more
+information.
+
+.. _`manage.py documentation`: http://www.djangoproject.com/documentation/django_admin/#sqlinitialdata-appname-appname