diff --git a/docs/howto/custom-management-commands.txt b/docs/howto/custom-management-commands.txt index 74b67b2ac29..e0e0bedd533 100644 --- a/docs/howto/custom-management-commands.txt +++ b/docs/howto/custom-management-commands.txt @@ -95,7 +95,16 @@ must be added to :attr:`~BaseCommand.option_list` like this: default=False, help='Delete poll instead of closing it'), ) - # ... + + def handle(self, *args, **options): + # ... + if options['delete']: + poll.delete() + # ... + +The option (``delete`` in our example) is available in the options dict +parameter of the handle method. See the :py:mod:`optparse` Python documentation +for more about ``make_option`` usage. In addition to being able to add custom command line options, all :doc:`management commands` can accept some