from django.db import DEFAULT_DB_ALIAS from sitetree.utils import get_tree_model, get_tree_item_model from sitetree.compat import CommandOption, options_getter MODEL_TREE_CLASS = get_tree_model() MODEL_TREE_ITEM_CLASS = get_tree_item_model() get_options = options_getter(( CommandOption( '--indent', default=None, dest='indent', type=int, help='Specifies the indent level to use when pretty-printing output.'), CommandOption('--items_only', action='store_true', dest='items_only', default=False, help='Export tree items only.'), CommandOption('--database', action='store', dest='database', default=DEFAULT_DB_ALIAS, help='Nominates a specific database to export fixtures from. Defaults to the "default" database.'), )) class Command(BaseCommand): option_list = get_options() help = 'Output sitetrees from database as a fixture in JSON format.' args = '[tree_alias tree_alias ...]' def add_arguments(self, parser): parser.add_argument('args', metavar='tree', nargs='?', help='Tree aliases.', default=[])
from django.core.management.base import BaseCommand from django.db import DEFAULT_DB_ALIAS from sitetree.utils import get_tree_model, import_project_sitetree_modules from sitetree.settings import APP_MODULE_NAME from sitetree.sitetreeapp import Cache from sitetree.compat import CommandOption, options_getter MODEL_TREE_CLASS = get_tree_model() get_options = options_getter((CommandOption( '--database', action='store', dest='database', default=DEFAULT_DB_ALIAS, help= 'Nominates a specific database to place trees and items into. Defaults to the "default" database.' ), )) class Command(BaseCommand): help = 'Places sitetrees of the project applications (defined in `app_name.sitetree.py`) into DB, ' \ 'replacing old ones if any.' args = '[app_name app_name ...]' option_list = get_options() def add_arguments(self, parser): parser.add_argument('args',
from django.core.management.base import BaseCommand from django.db import DEFAULT_DB_ALIAS from sitetree.utils import get_tree_model, import_project_sitetree_modules from sitetree.settings import APP_MODULE_NAME from sitetree.sitetreeapp import Cache from sitetree.compat import CommandOption, options_getter MODEL_TREE_CLASS = get_tree_model() get_options = options_getter(( CommandOption( '--database', action='store', dest='database', default=DEFAULT_DB_ALIAS, help='Nominates a specific database to place trees and items into. Defaults to the "default" database.' ), )) class Command(BaseCommand): help = 'Places sitetrees of the project applications (defined in `app_name.sitetree.py`) into DB, ' \ 'replacing old ones if any.' args = '[app_name app_name ...]' option_list = get_options() def add_arguments(self, parser): parser.add_argument('args', metavar='app', nargs='*', help='Application names.')
from sitetree.compat import CommandOption, options_getter, VERSION MODEL_TREE_CLASS = get_tree_model() MODEL_TREE_ITEM_CLASS = get_tree_item_model() get_options = options_getter(( CommandOption( '--indent', default=None, dest='indent', type=int, help='Specifies the indent level to use when pretty-printing output.'), CommandOption('--items_only', action='store_true', dest='items_only', default=False, help='Export tree items only.'), CommandOption( '--database', action='store', dest='database', default=DEFAULT_DB_ALIAS, help= 'Nominates a specific database to export fixtures from. Defaults to the "default" database.' ), )) class Command(BaseCommand): option_list = get_options()
from sitetree.compat import CommandOption, options_getter from sitetree.utils import get_tree_model, get_tree_item_model MODEL_TREE_CLASS = get_tree_model() MODEL_TREE_ITEM_CLASS = get_tree_item_model() get_options = options_getter(( CommandOption('--database', action='store', dest='database', default=DEFAULT_DB_ALIAS, help='Nominates a specific database to load fixtures into. ' 'Defaults to the "default" database.'), CommandOption( '--mode', action='store', dest='mode', default='append', help='Mode to put data into DB. Variants: `replace`, `append`.'), CommandOption( '--items_into_tree', action='store', dest='items_into_tree', default=None, help='Import only tree items data into tree with given alias.'), )) class Command(BaseCommand): option_list = get_options()
MODEL_TREE_CLASS = get_tree_model() MODEL_TREE_ITEM_CLASS = get_tree_item_model() VER_LESS_17 = VERSION < (1, 7) VER_LESS_18 = VERSION < (1, 8) get_options = options_getter(( CommandOption( '--database', action='store', dest='database', default=DEFAULT_DB_ALIAS, help='Nominates a specific database to load fixtures into. ' 'Defaults to the "default" database.'), CommandOption( '--mode', action='store', dest='mode', default='append', help='Mode to put data into DB. Variants: `replace`, `append`.'), CommandOption( '--items_into_tree', action='store', dest='items_into_tree', default=None, help='Import only tree items data into tree with given alias.'), )) class Command(BaseCommand): option_list = get_options() help = 'Loads sitetrees from fixture in JSON format into database.' args = '[fixture_file fixture_file ...]'