mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
[4.2.x] Fixed #34259 -- Passed called_from_command_line to command subparsers.
Backport of 017fa23d3b from main
This commit is contained in:
committed by
Mariusz Felisiak
parent
db0e10c037
commit
beaa5f31e1
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
|
||||
Reference in New Issue
Block a user