Commit 530ab32e authored by Claude Paroz's avatar Claude Paroz
Browse files

Fixed #18187 -- Completed example and details about custom command options....

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
parent d93b2a8d
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -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