mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #30763 -- Fixed management commands when using required mutually exclusive groups.
This commit is contained in:
committed by
Mariusz Felisiak
parent
350123f38c
commit
6c379f1a18
@@ -0,0 +1,12 @@
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
||||
def add_arguments(self, parser):
|
||||
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)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
self.stdout.write(','.join(options))
|
||||
Reference in New Issue
Block a user