mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Fixed #29152 -- Allowed passing kwargs to ArgumentParser initialization in management commands.
This commit is contained in:
parent
11bfe3a83d
commit
e95008f241
3 changed files with 21 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue