diff options
| author | Hasan Ramezani <hasan.r67@gmail.com> | 2019-06-26 22:04:58 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-06-28 12:51:26 +0200 |
| commit | 2b03e8e9e8205ae3a3aa128764277e70b7c30803 (patch) | |
| tree | 95f21a900a1a0eab7ebb819023c9e1c2d2375608 /tests/user_commands/management/commands/subparser_dest.py | |
| parent | f03b7bd11461e8b525c27d5344f8cd3a21c9565e (diff) | |
Fixed #30584 -- Fixed management command when using subparsers with dest parameter.
Diffstat (limited to 'tests/user_commands/management/commands/subparser_dest.py')
| -rw-r--r-- | tests/user_commands/management/commands/subparser_dest.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/user_commands/management/commands/subparser_dest.py b/tests/user_commands/management/commands/subparser_dest.py new file mode 100644 index 0000000000..ffea7efac7 --- /dev/null +++ b/tests/user_commands/management/commands/subparser_dest.py @@ -0,0 +1,13 @@ +from django.core.management.base import BaseCommand +from django.utils.version import PY37 + + +class Command(BaseCommand): + def add_arguments(self, parser): + kwargs = {'required': True} if PY37 else {} + subparsers = parser.add_subparsers(dest='subcommand', **kwargs) + parser_foo = subparsers.add_parser('foo') + parser_foo.add_argument('--bar') + + def handle(self, *args, **options): + self.stdout.write(','.join(options)) |
