Support positional arguments in management commands.
Review Request #10493 — Created April 2, 2019 and submitted — Latest diff uploaded
The compatibility layer for management commands tries to convert
new-style argument definitions tooptparse
on Django 1.6. However, one
major difference between the two is thatargparse
supports defining
positional arguments whereasoptparse
does not allow explicitly
defining these, instead leaving this up to the consuming command.This change simply filters out the positional argument definitions when
usingoptparse
, avoiding a crash. It still leaves the handling up to
the command, however, passing all positional arguments from the command
line.
Tested management commands defining positional arguments on both
Django 1.6 and 1.11.