From 0dce7b69210ed9fa60aa4eb1b4a8a571f23315c1 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Mon, 21 Jun 2010 12:09:25 +0000 Subject: [PATCH] Fixed #12619 -- Added support for the --noinput flag to testserver. Thanks to clouserw for the suggestion, and darkrho for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@13365 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/core/management/commands/testserver.py | 5 ++++- docs/ref/django-admin.txt | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/django/core/management/commands/testserver.py b/django/core/management/commands/testserver.py index 6c75a3e2b67..d3d9698c9ab 100644 --- a/django/core/management/commands/testserver.py +++ b/django/core/management/commands/testserver.py @@ -4,6 +4,8 @@ from optparse import make_option class Command(BaseCommand): option_list = BaseCommand.option_list + ( + make_option('--noinput', action='store_false', dest='interactive', default=True, + help='Tells Django to NOT prompt the user for input of any kind.'), make_option('--addrport', action='store', dest='addrport', type='string', default='', help='port number or ipaddr:port to run the server on'), @@ -18,10 +20,11 @@ class Command(BaseCommand): from django.db import connection verbosity = int(options.get('verbosity', 1)) + interactive = options.get('interactive', True) addrport = options.get('addrport') # Create a test database. - db_name = connection.creation.create_test_db(verbosity=verbosity) + db_name = connection.creation.create_test_db(verbosity=verbosity, autoclobber=not interactive) # Import the fixture data into the test database. call_command('loaddata', *fixture_labels, **{'verbosity': verbosity}) diff --git a/docs/ref/django-admin.txt b/docs/ref/django-admin.txt index 0918f5c1f4b..542a71582dd 100644 --- a/docs/ref/django-admin.txt +++ b/docs/ref/django-admin.txt @@ -804,8 +804,6 @@ with an appropriate extension (e.g. ``json`` or ``xml``). See the documentation for ``loaddata`` for details on the specification of fixture data files. ---noinput -~~~~~~~~~ The :djadminopt:`--noinput` option may be provided to suppress all user prompts. @@ -889,6 +887,11 @@ To run on 1.2.3.4:7000 with a ``test`` fixture:: django-admin.py testserver --addrport 1.2.3.4:7000 test +.. versionadded:: 1.3 + +The :djadminopt:`--noinput` option may be provided to suppress all user +prompts. + validate --------