1
0
mirror of https://github.com/django/django.git synced 2025-01-16 05:12:23 +00:00
Adam Johnson beaa5f31e1 [4.2.x] Fixed #34259 -- Passed called_from_command_line to command subparsers.
Backport of 017fa23d3b0aee9142f531c2a0002fc86c82a54c from main
2023-02-03 07:54:15 +01:00

14 lines
370 B
Python

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