mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #32047 -- Fixed call_command() crash if a constant option from required mutually exclusive group is passed in options.
This commit is contained in:
committed by
Mariusz Felisiak
parent
11c4a4412b
commit
6eb3f53bdd
@@ -7,6 +7,13 @@ class Command(BaseCommand):
|
||||
group = parser.add_mutually_exclusive_group(required=True)
|
||||
group.add_argument('--foo-id', type=int, nargs='?', default=None)
|
||||
group.add_argument('--foo-name', type=str, nargs='?', default=None)
|
||||
group.add_argument('--append_const', action='append_const', const=42)
|
||||
group.add_argument('--const', action='store_const', const=31)
|
||||
group.add_argument('--count', action='count')
|
||||
group.add_argument('--flag_false', action='store_false')
|
||||
group.add_argument('--flag_true', action='store_true')
|
||||
|
||||
def handle(self, *args, **options):
|
||||
self.stdout.write(','.join(options))
|
||||
for option, value in options.items():
|
||||
if value is not None:
|
||||
self.stdout.write('%s=%s' % (option, value))
|
||||
|
||||
Reference in New Issue
Block a user