summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2012-04-23 18:05:12 +0000
committerClaude Paroz <claude@2xlibre.net>2012-04-23 18:05:12 +0000
commit530ab32e9f0a9364cc20059d37b492315f760e63 (patch)
tree0d99ebc2344603ae49bded26903bcbae4a7ca53b /docs
parentd93b2a8d8d397ae2d85986414870d46c30a6258f (diff)
Fixed #18187 -- Completed example and details about custom command options. Thanks purple for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17930 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/howto/custom-management-commands.txt11
1 files changed, 10 insertions, 1 deletions
diff --git a/docs/howto/custom-management-commands.txt b/docs/howto/custom-management-commands.txt
index 74b67b2ac2..e0e0bedd53 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</ref/django-admin>` can accept some