However, everything is fine when I call this command in this way:
{{{
call_command('my_command, '--shop-id=1')
}}}
In django sources I found that only those keyword arguments of
call_command are passed to the parser that are defined as required:
{{{
# Any required arguments which are passed in via '**options' must be
passed
# to parse_args().
parse_args += [
'{}={}'.format(min(opt.option_strings), arg_options[opt.dest])
for opt in parser._actions if opt.required and opt.dest in options
]
}}}
but in this special case both of them individually are not required, they
are actually part of a group that is required. And the code of
call_command does nothing with groups defined in the parser.
--
Ticket URL: <https://code.djangoproject.com/ticket/30763>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: Hasan Ramezani (added)
* version: 2.2 => master
* stage: Unreviewed => Accepted
Comment:
Thanks for this report. I attached a simple test.
Reproduced at ed2d411aa84efc76baba3adf0d0f99df0e44ba57.
--
Ticket URL: <https://code.djangoproject.com/ticket/30763#comment:1>
* Attachment "test-30763.diff" added.
* owner: nobody => Hasan Ramezani
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/30763#comment:2>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/30763#comment:3>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"6c379f1a1897a0e0b95531ea7d9806b17b22ff89" 6c379f1]:
{{{
#!CommitTicketReference repository=""
revision="6c379f1a1897a0e0b95531ea7d9806b17b22ff89"
Fixed #30763 -- Fixed management commands when using required mutually
exclusive groups.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30763#comment:4>