CyberSeed2017 / django_server

0 stars 0 forks source link

programatically create a group with permissions #13

Open MichaelDimmitt opened 7 years ago

MichaelDimmitt commented 7 years ago

https://stackoverflow.com/questions/22250352/in-django-how-do-you-programmatically-create-a-group-with-permissions

MichaelDimmitt commented 7 years ago

https://code.djangoproject.com/wiki/Fixtures

FIXTURE_DIRS = (
   'path/smirk/fixtures/',
)

Lets dump our data:

cd path/unf
python manage.py dumpdata --format=json smirk > path/smirk/fixtures/initial_data.json

Reset:

python manage.py reset smirk
Type 'yes' to continue, or 'no' to cancel: yes
python manage.py syncdb

Loading 'initial_data' fixtures... Installing json fixture 'initial_data' from '/path/to/myapp/fixtures/'. Installed 24 object(s) from 1 fixture(s)****