adding fixtures stub and load_initial_data management command

pull/20/head
David Ray 2017-02-10 07:58:01 -05:00
rodzic 2c6029682a
commit 3e5ce066f8
4 zmienionych plików z 31 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,18 @@
[{
"model": "auth.user",
"pk": 1,
"fields": {
"password": "pbkdf2_sha256$30000$E9Uhcl4mkQtv$WxS3m0ZzdJXWmI7nAae9wmybd2L2HK5zgjHHXc65+oo=",
"last_login": null,
"is_superuser": true,
"username": "admin",
"first_name": "",
"last_name": "",
"email": "",
"is_staff": true,
"is_active": true,
"date_joined": "2017-02-10T12:48:21.920Z",
"groups": [],
"user_permissions": []
}
}]

Wyświetl plik

@ -0,0 +1,13 @@
import os
from django.conf import settings
from django.core.management.base import BaseCommand
from django.core.management import call_command
class Command(BaseCommand):
def handle(self, **options):
fixtures_dir = os.path.join(settings.BASE_DIR, 'base', 'fixtures')
fixture_file = os.path.join(fixtures_dir, 'bakerydemo.json')
call_command('loaddata', fixture_file, verbosity=0)