Fixed #33205 -- Made call_command() raise TypeError when dest with multiple arguments is passed.

This commit is contained in:
Hasan Ramezani 2021-10-22 16:38:14 +02:00 committed by Mariusz Felisiak
parent 1feb55d607
commit c1e4111c74
3 changed files with 54 additions and 0 deletions

View file

@ -0,0 +1,13 @@
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('--for', dest='until', action='store')
group.add_argument('--until', action='store')
def handle(self, *args, **options):
for option, value in options.items():
if value is not None:
self.stdout.write('%s=%s' % (option, value))