Legend:

Django allows you to put initial SQL data using plain files with RAW SQL data, which would force you to make such file for each database and if you depend on some django data (groups, users) then IDs in the SQL dump may be wrong if someone has bit different django project running.

2

3

4

= Initial SQL data using Django ORM =

5

* Create in the main django project folder file called '''install.py'''

6

* Add the code:

7

{{{

8

from os import environ

9

environ['DJANGO_SETTINGS_MODULE'] = 'settings'

10

11

from settings import *

12

}}}

13

And this is the 100% of magic. We set DJANGO_SETTINGS_MODULE for Django (which is refering to settings.py in the same folder) and then import settings.py in the python sense.

We imported a model and added some data. In the '''Forum''' case (which are many2one with '''Category''') we need to pass the '''Category''' object :) And don't use IDs in get() when refering to "external" or other data that may be different than in your install :)

Import models and add. You can find something about adding permissions to user/group in the auth docs, but more help '''django/contrib/auth/models.py''' will probably provide. In the example I've added permission from Page model (add_MODEL, change_MODEL etc. are standard codenames for each model). If you have problems with getting right codenames: