fix: run all models when none specified, for import/export commands
This commit is contained in:
parent
7e3e892002
commit
4f80085254
3 changed files with 14 additions and 9 deletions
|
|
@ -125,15 +125,15 @@ class ImportCommandHandler(GenericHandler):
|
|||
return
|
||||
|
||||
# otherwise process some data
|
||||
log.debug("using handler: %s", self.import_handler.get_spec())
|
||||
kw = dict(params)
|
||||
models = kw.pop("models")
|
||||
log.debug("using handler: %s", self.import_handler.get_spec())
|
||||
# TODO: need to use all/default models if none specified
|
||||
# (and should know models by now for logging purposes)
|
||||
if not models:
|
||||
models = list(self.import_handler.importers)
|
||||
log.debug(
|
||||
"running %s %s for: %s",
|
||||
self.import_handler,
|
||||
self.import_handler.orientation.value,
|
||||
"%s %s for models: %s",
|
||||
self.import_handler.actioning,
|
||||
self.import_handler.get_title(),
|
||||
", ".join(models),
|
||||
)
|
||||
log.debug("params are: %s", kw)
|
||||
|
|
|
|||
|
|
@ -459,7 +459,10 @@ class Importer: # pylint: disable=too-many-instance-attributes,too-many-public-
|
|||
updated = []
|
||||
deleted = []
|
||||
|
||||
log.debug("using key fields: %s", ", ".join(self.get_keys()))
|
||||
model_title = self.get_model_title()
|
||||
log.debug(
|
||||
"using key fields for %s: %s", model_title, ", ".join(self.get_keys())
|
||||
)
|
||||
|
||||
# get complete set of normalized source data
|
||||
if source_data is None:
|
||||
|
|
@ -468,8 +471,7 @@ class Importer: # pylint: disable=too-many-instance-attributes,too-many-public-
|
|||
# nb. prune duplicate records from source data
|
||||
source_data, source_keys = self.get_unique_data(source_data)
|
||||
|
||||
model_title = self.get_model_title()
|
||||
log.debug(f"got %s {model_title} records from source", len(source_data))
|
||||
log.debug("got %s %s records from source", len(source_data), model_title)
|
||||
|
||||
# maybe cache existing target data
|
||||
if self.caches_target:
|
||||
|
|
|
|||
|
|
@ -335,6 +335,9 @@ class ImportHandler(GenericHandler): # pylint: disable=too-many-public-methods
|
|||
self.begin_transaction()
|
||||
changes = OrderedDict()
|
||||
|
||||
if not keys:
|
||||
keys = list(self.importers)
|
||||
|
||||
success = False
|
||||
try:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue