#33205: call_command() fails when required mutually exclusive arguments use the same `dest`. -------------------------------------+------------------------------------- Reporter: Peter Law | Owner: nobody Type: Bug | Status: new Component: Core (Management | Version: 3.2 commands) | Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by Hasan Ramezani): Replying to [comment:4 Mariusz Felisiak]: I am not sure about your second example: > * `management.call_command('pause', **{'for': '1'})` should work the same as calling `pause --for 1` Based on the documentation, it seems we have to pass `dest` as keyword argument name when we define `dest` for arguments. >Some command options have different names when using call_command() instead of django-admin or manage.py. For example, django-admin createsuperuser --no-input translates to call_command('createsuperuser', interactive=False). To find what keyword argument name to use for call_command(), check the command’s source code for the dest argument passed to parser.add_argument(). Also, when Django [https://github.com/django/django/blob/e2f778d57947d168a875159e6df075255eea4bbc/django/core/management/__init__.py#L149 adds required arguments in call command], it search for `dest` in options. -- Ticket URL: <https://code.djangoproject.com/ticket/33205#comment:5> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/068.4e8ec98279d5ab890390e07b919671cd%40djangoproject.com.