Fixed #25350 -- Added alias --no-input for --noinput to management commands.

This commit is contained in:
Raphael Michel 2015-09-07 15:17:55 +02:00 committed by Tim Graham
parent 25c157e4cc
commit 1bbca7961c
11 changed files with 29 additions and 10 deletions

View File

@ -33,7 +33,8 @@ class Command(BaseCommand):
parser.add_argument('--%s' % self.UserModel.USERNAME_FIELD, parser.add_argument('--%s' % self.UserModel.USERNAME_FIELD,
dest=self.UserModel.USERNAME_FIELD, default=None, dest=self.UserModel.USERNAME_FIELD, default=None,
help='Specifies the login for the superuser.') help='Specifies the login for the superuser.')
parser.add_argument('--noinput', action='store_false', dest='interactive', default=True, parser.add_argument('--noinput', '--no-input',
action='store_false', dest='interactive', default=True,
help=('Tells Django to NOT prompt the user for input of any kind. ' help=('Tells Django to NOT prompt the user for input of any kind. '
'You must use --%s with --noinput, along with an option for ' 'You must use --%s with --noinput, along with an option for '
'any other required field. Superusers created with --noinput will ' 'any other required field. Superusers created with --noinput will '

View File

@ -36,7 +36,7 @@ class Command(BaseCommand):
self.local = True self.local = True
def add_arguments(self, parser): def add_arguments(self, parser):
parser.add_argument('--noinput', parser.add_argument('--noinput', '--no-input',
action='store_false', dest='interactive', default=True, action='store_false', dest='interactive', default=True,
help="Do NOT prompt the user for input of any kind.") help="Do NOT prompt the user for input of any kind.")
parser.add_argument('--no-post-process', parser.add_argument('--no-post-process',

View File

@ -17,7 +17,8 @@ class Command(BaseCommand):
'migrations. Does not achieve a "fresh install" state.') 'migrations. Does not achieve a "fresh install" state.')
def add_arguments(self, parser): def add_arguments(self, parser):
parser.add_argument('--noinput', action='store_false', dest='interactive', default=True, parser.add_argument('--noinput', '--no-input',
action='store_false', dest='interactive', default=True,
help='Tells Django to NOT prompt the user for input of any kind.') help='Tells Django to NOT prompt the user for input of any kind.')
parser.add_argument('--database', action='store', dest='database', parser.add_argument('--database', action='store', dest='database',
default=DEFAULT_DB_ALIAS, default=DEFAULT_DB_ALIAS,

View File

@ -29,7 +29,8 @@ class Command(BaseCommand):
help="Enable fixing of migration conflicts.") help="Enable fixing of migration conflicts.")
parser.add_argument('--empty', action='store_true', dest='empty', default=False, parser.add_argument('--empty', action='store_true', dest='empty', default=False,
help="Create an empty migration.") help="Create an empty migration.")
parser.add_argument('--noinput', action='store_false', dest='interactive', default=True, parser.add_argument('--noinput', '--no-input',
action='store_false', dest='interactive', default=True,
help='Tells Django to NOT prompt the user for input of any kind.') help='Tells Django to NOT prompt the user for input of any kind.')
parser.add_argument('-n', '--name', action='store', dest='name', default=None, parser.add_argument('-n', '--name', action='store', dest='name', default=None,
help="Use this name for migration file(s).") help="Use this name for migration file(s).")

View File

@ -33,7 +33,8 @@ class Command(BaseCommand):
'migration. Use the name "zero" to unapply all migrations.' 'migration. Use the name "zero" to unapply all migrations.'
), ),
) )
parser.add_argument('--noinput', action='store_false', dest='interactive', default=True, parser.add_argument('--noinput', '--no-input',
action='store_false', dest='interactive', default=True,
help='Tells Django to NOT prompt the user for input of any kind.') help='Tells Django to NOT prompt the user for input of any kind.')
parser.add_argument('--database', action='store', dest='database', parser.add_argument('--database', action='store', dest='database',
default=DEFAULT_DB_ALIAS, help='Nominates a database to synchronize. ' default=DEFAULT_DB_ALIAS, help='Nominates a database to synchronize. '

View File

@ -19,7 +19,8 @@ class Command(BaseCommand):
help='Migrations will be squashed until and including this migration.') help='Migrations will be squashed until and including this migration.')
parser.add_argument('--no-optimize', action='store_true', dest='no_optimize', default=False, parser.add_argument('--no-optimize', action='store_true', dest='no_optimize', default=False,
help='Do not try to optimize the squashed operations.') help='Do not try to optimize the squashed operations.')
parser.add_argument('--noinput', action='store_false', dest='interactive', default=True, parser.add_argument('--noinput', '--no-input',
action='store_false', dest='interactive', default=True,
help='Tells Django to NOT prompt the user for input of any kind.') help='Tells Django to NOT prompt the user for input of any kind.')
def handle(self, **options): def handle(self, **options):

View File

@ -32,7 +32,7 @@ class Command(BaseCommand):
def add_arguments(self, parser): def add_arguments(self, parser):
parser.add_argument('args', metavar='test_label', nargs='*', parser.add_argument('args', metavar='test_label', nargs='*',
help='Module paths to test; can be modulename, modulename.TestCase or modulename.TestCase.test_method') help='Module paths to test; can be modulename, modulename.TestCase or modulename.TestCase.test_method')
parser.add_argument('--noinput', parser.add_argument('--noinput', '--no-input',
action='store_false', dest='interactive', default=True, action='store_false', dest='interactive', default=True,
help='Tells Django to NOT prompt the user for input of any kind.'), help='Tells Django to NOT prompt the user for input of any kind.'),
parser.add_argument('--failfast', parser.add_argument('--failfast',

View File

@ -11,7 +11,8 @@ class Command(BaseCommand):
def add_arguments(self, parser): def add_arguments(self, parser):
parser.add_argument('args', metavar='fixture', nargs='*', parser.add_argument('args', metavar='fixture', nargs='*',
help='Path(s) to fixtures to load before running the server.') help='Path(s) to fixtures to load before running the server.')
parser.add_argument('--noinput', action='store_false', dest='interactive', default=True, parser.add_argument('--noinput', '--no-input',
action='store_false', dest='interactive', default=True,
help='Tells Django to NOT prompt the user for input of any kind.') help='Tells Django to NOT prompt the user for input of any kind.')
parser.add_argument('--addrport', default='', parser.add_argument('--addrport', default='',
help='Port number or ipaddr:port to run the server on.') help='Port number or ipaddr:port to run the server on.')

View File

@ -90,7 +90,12 @@ Some commonly used options are:
.. django-admin-option:: --noinput .. django-admin-option:: --noinput
Do NOT prompt the user for input of any kind. Do NOT prompt the user for input of any kind. You can use ``--no-input``
as an alias for this option.
.. versionchanged:: 1.9
The ``--no-input`` alias was added.
.. django-admin-option:: -i <pattern> .. django-admin-option:: -i <pattern>
.. django-admin-option:: --ignore <pattern> .. django-admin-option:: --ignore <pattern>

View File

@ -1552,7 +1552,12 @@ If not provided all locales are processed.
Use the ``--noinput`` option to suppress all user prompting, such as "Are Use the ``--noinput`` option to suppress all user prompting, such as "Are
you sure?" confirmation messages. This is useful if ``django-admin`` is you sure?" confirmation messages. This is useful if ``django-admin`` is
being executed as an unattended, automated script. being executed as an unattended, automated script. You can use ``--no-input``
as an alias for this option.
.. versionchanged:: 1.9
The ``--no-input`` alias was added.
Extra niceties Extra niceties
============== ==============

View File

@ -418,6 +418,9 @@ Management Commands
* The ``django`` package may be run as a script, i.e. ``python -m django``, * The ``django`` package may be run as a script, i.e. ``python -m django``,
which will behave the same as ``django-admin``. which will behave the same as ``django-admin``.
* Management commands that have the ``--noinput`` option now also take
``--no-input`` as an alias for that option.
Migrations Migrations
^^^^^^^^^^ ^^^^^^^^^^