summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorKrzysztof Żuraw <krzysztof.zuraw@gmail.com>2016-11-05 17:14:26 +0100
committerTim Graham <timograham@gmail.com>2016-11-06 12:52:09 +0100
commit07db0e068fbf5c74600acfdc7d6891df2ade7243 (patch)
treef171fd1cfa554448709877711e6194adb0b36370 /docs
parenta2d2d455b6cb848a86f916e86ce00955965a9a4f (diff)
[1.10.x] Fixed #27133 -- Doc'd how to provide initial data with migrations.
Backport of eaa6ea2f37509f2e54de5268f32469deeff89eb9 from master
Diffstat (limited to 'docs')
-rw-r--r--docs/howto/initial-data.txt11
1 files changed, 10 insertions, 1 deletions
diff --git a/docs/howto/initial-data.txt b/docs/howto/initial-data.txt
index ac5839022d..5945073889 100644
--- a/docs/howto/initial-data.txt
+++ b/docs/howto/initial-data.txt
@@ -3,7 +3,8 @@ Providing initial data for models
=================================
It's sometimes useful to pre-populate your database with hard-coded data when
-you're first setting up an app. You can provide initial data via fixtures.
+you're first setting up an app. You can provide initial data with fixtures or
+migrations.
.. _initial-data-via-fixtures:
@@ -83,3 +84,11 @@ directories.
Fixtures are also used by the :ref:`testing framework
<topics-testing-fixtures>` to help set up a consistent test environment.
+
+Providing initial data with migrations
+======================================
+
+If you want to automatically load initial data for an app, don't use fixtures.
+Instead, create a migration for your application with
+:class:`~django.db.migrations.operations.RunPython` or
+:class:`~django.db.migrations.operations.RunSQL` operations.