summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorhumbertotm <humberto.htm@gmail.com>2018-06-11 10:20:50 -0700
committerTim Graham <timograham@gmail.com>2018-06-16 15:54:59 -0400
commite95008f2411d50929873f634c3e14ebac811fd28 (patch)
tree0b158a14a3df09b1f568dcb81ac43c0a6fed5b4b /docs
parent11bfe3a83d79c832bd861b6b87f254197fde1659 (diff)
Fixed #29152 -- Allowed passing kwargs to ArgumentParser initialization in management commands.
Diffstat (limited to 'docs')
-rw-r--r--docs/howto/custom-management-commands.txt13
1 files changed, 13 insertions, 0 deletions
diff --git a/docs/howto/custom-management-commands.txt b/docs/howto/custom-management-commands.txt
index dadbaf9742..f20252dc0c 100644
--- a/docs/howto/custom-management-commands.txt
+++ b/docs/howto/custom-management-commands.txt
@@ -255,6 +255,19 @@ the :meth:`~BaseCommand.handle` method must be implemented.
super().__init__(*args, **kwargs)
# ...
+.. method:: BaseCommand.create_parser(prog_name, subcommand, **kwargs)
+
+ Returns a ``CommandParser`` instance, which is an
+ :class:`~argparse.ArgumentParser` subclass with a few customizations for
+ Django.
+
+ You can customize the instance by overriding this method and calling
+ ``super()`` with ``kwargs`` of :class:`~argparse.ArgumentParser` parameters.
+
+ .. versionchanged:: 2.2
+
+ ``kwargs`` was added.
+
.. method:: BaseCommand.add_arguments(parser)
Entry point to add parser arguments to handle command line arguments passed