pcari.management.commands package¶
Submodules¶
Module contents¶
This module defines common command templates.
References
-
class
pcari.management.commands.BatchProcessingCommand(stdout=None, stderr=None, no_color=False)¶ Bases:
django.core.management.base.BaseCommandA
BatchProcessingCommandprovides utilities for manipulating a sequence of fields, which would be useful for cleaning or exporting data.-
add_arguments(parser)¶
-
handle(*args, **options)¶
-
postprocess(options)¶ Terminate the processing job (e.g. close files).
Parameters: options (dict) – Keyword arguments from the command line.
-
precondition_check(options, model, field)¶ Raise exceptions as necessary prior to processing model instances.
Parameters: - options (dict) – Keyword arguments from the command line.
- model – The model to be inspected.
- field – The field of
modelto be inspected.
Raises: CommandError– if some precondition is not met.
-
preprocess(options)¶ Prepare to batch process all fields (e.g. open files).
Parameters: options (dict) – Keyword arguments from the command line.
-
process(options, instance, model_name, field_name)¶ Given a model instance and the field to operate on, perform an action.
Parameters: - options (dict) – Keyword arguments from the command line.
- instance – The model instance to be processed.
- model_name (str) – The name of the model of
instance. - field_name (str) – The name of the field to be processed.
-