mirror of
https://github.com/django/django.git
synced 2025-07-23 05:05:17 +00:00
Fixed #34259 -- Passed called_from_command_line to command subparsers.
This commit is contained in:
parent
1250483ebf
commit
017fa23d3b
3 changed files with 47 additions and 0 deletions
13
tests/user_commands/management/commands/subparser_vanilla.py
Normal file
13
tests/user_commands/management/commands/subparser_vanilla.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
import argparse
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
def add_arguments(self, parser):
|
||||
subparsers = parser.add_subparsers(parser_class=argparse.ArgumentParser)
|
||||
parser_foo = subparsers.add_parser("foo")
|
||||
parser_foo.add_argument("bar", type=int)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
pass
|
Loading…
Add table
Add a link
Reference in a new issue