#33430: Calling command via `call_command` with option that is `required` and 
has
set `dest` leads to an error
-------------------------------------+-------------------------------------
               Reporter:  micuda     |          Owner:  nobody
                   Type:  Bug        |         Status:  new
              Component:  Core       |        Version:  3.2
  (Management commands)              |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 Calling command via `call_command` with option that is `required` and has
 set `dest` leads to an error:

 "Error: the following arguments are required: <option>"

 ----

 Code to simulate behaviour:

 {{{
 from django.core.management.base import BaseCommand, CommandParser

 class Command(BaseCommand):
     def add_arguments(self, parser: CommandParser):
         # parser.add_argument('--from') # OK
         # parser.add_argument('--from', dest='from_') # OK
         # parser.add_argument('--from', required=True) # OK
         parser.add_argument('--from', required=True, dest='from_') # leads
 to an error

     def handle(self, *args, **options):
         ...
 }}}

 and calling the command:

 {{{
 call_command('bug_report', **{ 'from': '2022-01-11' })
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33430>
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/049.e879502ab4a56f3c3fff9f70938f866d%40djangoproject.com.

Reply via email to