Skip to content
Browse files

Fixed #18187 -- Completed example and details about custom command op…

…tions. Thanks purple for the report.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent d93b2a8 commit 530ab32e9f0a9364cc20059d37b492315f760e63 @claudep claudep committed
Showing with 10 additions and 1 deletion.
  1. +10 −1 docs/howto/custom-management-commands.txt
11 docs/howto/custom-management-commands.txt
@@ -95,7 +95,16 @@ must be added to :attr:`~BaseCommand.option_list` like this:
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</ref/django-admin>` can accept some

0 comments on commit 530ab32

Please sign in to comment.
Something went wrong with that request. Please try again.