Class ManagementUtility
Encapsulate the logic of the django-admin and manage.py utilities.
Declaration
class ManagementUtility
source linkDocumentation
Methods
▶ def autocomplete(self) Output completion suggestions for BASH.
The output of this function is passed to BASH's `COMREPLY` variable and
treated as completion suggestions. `COMREPLY` expects a space
separated string as the result.
The `COMP_WORDS` and `COMP_CWORD` BASH environment variables are used
to get information about the cli input. Please refer to the BASH
man-page for more information about this variables.
Subcommand options are saved as pairs. A pair consists of
the long option string (e.g. '--exclude') and a boolean
value indicating if the option requires arguments. When printing to
stdout, an equal sign is appended to options which require arguments.
Note: If debugging this function, it is recommended to write the debug
output in a separate file. Otherwise the debug output will be treated
and formatted as potential completion suggestions.
▷ def execute(self) Given the command-line arguments, figure out which subcommand is being run, create a parser appropriate to that command, and run it.
▷ def fetch_command(self, subcommand) Try to fetch the given subcommand, printing a message with the appropriate command called from the command line (usually "django-admin" or "manage.py") if it can't be found.
▷ def main_help_text(self, commands_only=False) Return the script's main help text, as a string.