diff --git a/django/contrib/auth/management/commands/changepassword.py b/django/contrib/auth/management/commands/changepassword.py index f4ec15a439..a69362f05c 100644 --- a/django/contrib/auth/management/commands/changepassword.py +++ b/django/contrib/auth/management/commands/changepassword.py @@ -26,7 +26,7 @@ class Command(BaseCommand): help='Username to change password for; by default, it\'s the current username.', ) parser.add_argument( - '--database', action='store', dest='database', + '--database', default=DEFAULT_DB_ALIAS, help='Specifies the database to use. Default is "default".', ) diff --git a/django/contrib/auth/management/commands/createsuperuser.py b/django/contrib/auth/management/commands/createsuperuser.py index d142679168..fb3cda7662 100644 --- a/django/contrib/auth/management/commands/createsuperuser.py +++ b/django/contrib/auth/management/commands/createsuperuser.py @@ -30,7 +30,6 @@ class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument( '--%s' % self.UserModel.USERNAME_FIELD, - dest=self.UserModel.USERNAME_FIELD, default=None, help='Specifies the login for the superuser.', ) parser.add_argument( @@ -44,13 +43,13 @@ class Command(BaseCommand): ), ) parser.add_argument( - '--database', action='store', dest='database', + '--database', default=DEFAULT_DB_ALIAS, help='Specifies the database to use. Default is "default".', ) for field in self.UserModel.REQUIRED_FIELDS: parser.add_argument( - '--%s' % field, dest=field, default=None, + '--%s' % field, help='Specifies the %s for the superuser.' % field, ) diff --git a/django/contrib/contenttypes/management/commands/remove_stale_contenttypes.py b/django/contrib/contenttypes/management/commands/remove_stale_contenttypes.py index e92c701221..9cc559dc1d 100644 --- a/django/contrib/contenttypes/management/commands/remove_stale_contenttypes.py +++ b/django/contrib/contenttypes/management/commands/remove_stale_contenttypes.py @@ -15,7 +15,7 @@ class Command(BaseCommand): help='Tells Django to NOT prompt the user for input of any kind.', ) parser.add_argument( - '--database', action='store', dest='database', default=DEFAULT_DB_ALIAS, + '--database', default=DEFAULT_DB_ALIAS, help='Nominates the database to use. Defaults to the "default" database.', ) diff --git a/django/contrib/gis/management/commands/ogrinspect.py b/django/contrib/gis/management/commands/ogrinspect.py index a507c1d0fc..03d31899bf 100644 --- a/django/contrib/gis/management/commands/ogrinspect.py +++ b/django/contrib/gis/management/commands/ogrinspect.py @@ -43,21 +43,21 @@ class Command(BaseCommand): parser.add_argument('data_source', help='Path to the data source.') parser.add_argument('model_name', help='Name of the model to create.') parser.add_argument( - '--blank', dest='blank', + '--blank', action=ListOptionAction, default=False, help='Use a comma separated list of OGR field names to add ' 'the `blank=True` option to the field definition. Set to `true` ' 'to apply to all applicable fields.', ) parser.add_argument( - '--decimal', dest='decimal', + '--decimal', action=ListOptionAction, default=False, help='Use a comma separated list of OGR float fields to ' 'generate `DecimalField` instead of the default ' '`FloatField`. Set to `true` to apply to all OGR float fields.', ) parser.add_argument( - '--geom-name', dest='geom_name', default='geom', + '--geom-name', default='geom', help='Specifies the model name for the Geometry Field (defaults to `geom`)' ) parser.add_argument( @@ -68,11 +68,11 @@ class Command(BaseCommand): 'an integer or a string identifier for the layer.', ) parser.add_argument( - '--multi-geom', action='store_true', dest='multi_geom', + '--multi-geom', action='store_true', help='Treat the geometry in the data source as a geometry collection.', ) parser.add_argument( - '--name-field', dest='name_field', + '--name-field', help='Specifies a field name to return for the __str__() method.', ) parser.add_argument( @@ -80,18 +80,18 @@ class Command(BaseCommand): help='Do not include `from django.contrib.gis.db import models` statement.', ) parser.add_argument( - '--null', dest='null', action=ListOptionAction, default=False, + '--null', action=ListOptionAction, default=False, help='Use a comma separated list of OGR field names to add ' 'the `null=True` option to the field definition. Set to `true` ' 'to apply to all applicable fields.', ) parser.add_argument( - '--srid', dest='srid', + '--srid', help='The SRID to use for the Geometry Field. If it can be ' 'determined, the SRID of the data source is used.', ) parser.add_argument( - '--mapping', action='store_true', dest='mapping', + '--mapping', action='store_true', help='Generate mapping dictionary for use with `LayerMapping`.', ) diff --git a/django/contrib/sitemaps/management/commands/ping_google.py b/django/contrib/sitemaps/management/commands/ping_google.py index d362372bed..a72d2add60 100644 --- a/django/contrib/sitemaps/management/commands/ping_google.py +++ b/django/contrib/sitemaps/management/commands/ping_google.py @@ -6,7 +6,7 @@ class Command(BaseCommand): help = "Ping Google with an updated sitemap, pass optional url of sitemap" def add_arguments(self, parser): - parser.add_argument('sitemap_url', nargs='?', default=None) + parser.add_argument('sitemap_url', nargs='?') def handle(self, *args, **options): ping_google(sitemap_url=options['sitemap_url']) diff --git a/django/contrib/staticfiles/management/commands/collectstatic.py b/django/contrib/staticfiles/management/commands/collectstatic.py index a07b5f3c9a..4aeabb8d70 100644 --- a/django/contrib/staticfiles/management/commands/collectstatic.py +++ b/django/contrib/staticfiles/management/commands/collectstatic.py @@ -51,16 +51,16 @@ class Command(BaseCommand): "pattern. Use multiple times to ignore more.", ) parser.add_argument( - '-n', '--dry-run', action='store_true', dest='dry_run', + '-n', '--dry-run', action='store_true', help="Do everything except modify the filesystem.", ) parser.add_argument( - '-c', '--clear', action='store_true', dest='clear', + '-c', '--clear', action='store_true', help="Clear the existing files using the storage " "before trying to copy or link the original file.", ) parser.add_argument( - '-l', '--link', action='store_true', dest='link', + '-l', '--link', action='store_true', help="Create a symbolic link to each file instead of copying.", ) parser.add_argument( diff --git a/django/core/management/base.py b/django/core/management/base.py index 595fb29e21..651674534f 100644 --- a/django/core/management/base.py +++ b/django/core/management/base.py @@ -259,7 +259,7 @@ class BaseCommand: ) parser.add_argument('--version', action='version', version=self.get_version()) parser.add_argument( - '-v', '--verbosity', action='store', dest='verbosity', default=1, + '-v', '--verbosity', default=1, type=int, choices=[0, 1, 2, 3], help='Verbosity level; 0=minimal output, 1=normal output, 2=verbose output, 3=very verbose output', ) @@ -277,7 +277,7 @@ class BaseCommand: ) parser.add_argument('--traceback', action='store_true', help='Raise on CommandError exceptions') parser.add_argument( - '--no-color', action='store_true', dest='no_color', + '--no-color', action='store_true', help="Don't colorize the command output.", ) self.add_arguments(parser) diff --git a/django/core/management/commands/check.py b/django/core/management/commands/check.py index e119960f44..b85da64bc7 100644 --- a/django/core/management/commands/check.py +++ b/django/core/management/commands/check.py @@ -16,18 +16,17 @@ class Command(BaseCommand): help='Run only checks labeled with given tag.', ) parser.add_argument( - '--list-tags', action='store_true', dest='list_tags', + '--list-tags', action='store_true', help='List available tags.', ) parser.add_argument( - '--deploy', action='store_true', dest='deploy', + '--deploy', action='store_true', help='Check deployment settings.', ) parser.add_argument( '--fail-level', default='ERROR', choices=['CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG'], - dest='fail_level', help=( 'Message level that will cause the command to exit with a ' 'non-zero status. Default is ERROR.' diff --git a/django/core/management/commands/compilemessages.py b/django/core/management/commands/compilemessages.py index 0934874662..80537dd6ac 100644 --- a/django/core/management/commands/compilemessages.py +++ b/django/core/management/commands/compilemessages.py @@ -34,12 +34,12 @@ class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument( - '--locale', '-l', dest='locale', action='append', default=[], + '--locale', '-l', action='append', default=[], help='Locale(s) to process (e.g. de_AT). Default is to process all. ' 'Can be used multiple times.', ) parser.add_argument( - '--exclude', '-x', dest='exclude', action='append', default=[], + '--exclude', '-x', action='append', default=[], help='Locales to exclude. Default is none. Can be used multiple times.', ) parser.add_argument( diff --git a/django/core/management/commands/createcachetable.py b/django/core/management/commands/createcachetable.py index 3acb3ddf72..7e4edfc24f 100644 --- a/django/core/management/commands/createcachetable.py +++ b/django/core/management/commands/createcachetable.py @@ -19,13 +19,13 @@ class Command(BaseCommand): help='Optional table names. Otherwise, settings.CACHES is used to find cache tables.', ) parser.add_argument( - '--database', action='store', dest='database', + '--database', default=DEFAULT_DB_ALIAS, help='Nominates a database onto which the cache tables will be ' 'installed. Defaults to the "default" database.', ) parser.add_argument( - '--dry-run', action='store_true', dest='dry_run', + '--dry-run', action='store_true', help='Does not create the table, just prints the SQL that would be run.', ) diff --git a/django/core/management/commands/dbshell.py b/django/core/management/commands/dbshell.py index eda1ff68c9..1cb6b52f04 100644 --- a/django/core/management/commands/dbshell.py +++ b/django/core/management/commands/dbshell.py @@ -12,7 +12,7 @@ class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument( - '--database', action='store', dest='database', default=DEFAULT_DB_ALIAS, + '--database', default=DEFAULT_DB_ALIAS, help='Nominates a database onto which to open a shell. Defaults to the "default" database.', ) diff --git a/django/core/management/commands/diffsettings.py b/django/core/management/commands/diffsettings.py index 5d1621eb08..972128b8cb 100644 --- a/django/core/management/commands/diffsettings.py +++ b/django/core/management/commands/diffsettings.py @@ -14,21 +14,21 @@ class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument( - '--all', action='store_true', dest='all', + '--all', action='store_true', help=( 'Display all settings, regardless of their value. In "hash" ' 'mode, default values are prefixed by "###".' ), ) parser.add_argument( - '--default', dest='default', metavar='MODULE', default=None, + '--default', metavar='MODULE', help=( "The settings module to compare the current settings against. Leave empty to " "compare against Django's default settings." ), ) parser.add_argument( - '--output', default='hash', choices=('hash', 'unified'), dest='output', + '--output', default='hash', choices=('hash', 'unified'), help=( "Selects the output format. 'hash' mode displays each changed " "setting, with the settings that don't appear in the defaults " diff --git a/django/core/management/commands/dumpdata.py b/django/core/management/commands/dumpdata.py index ae00a3b6bf..31df5ac244 100644 --- a/django/core/management/commands/dumpdata.py +++ b/django/core/management/commands/dumpdata.py @@ -24,21 +24,21 @@ class Command(BaseCommand): help='Restricts dumped data to the specified app_label or app_label.ModelName.', ) parser.add_argument( - '--format', default='json', dest='format', + '--format', default='json', help='Specifies the output serialization format for fixtures.', ) parser.add_argument( - '--indent', default=None, dest='indent', type=int, + '--indent', type=int, help='Specifies the indent level to use when pretty-printing output.', ) parser.add_argument( - '--database', action='store', dest='database', + '--database', default=DEFAULT_DB_ALIAS, help='Nominates a specific database to dump fixtures from. ' 'Defaults to the "default" database.', ) parser.add_argument( - '-e', '--exclude', dest='exclude', action='append', default=[], + '-e', '--exclude', action='append', default=[], help='An app_label or app_label.ModelName to exclude ' '(use multiple --exclude to exclude multiple apps/models).', ) @@ -61,7 +61,7 @@ class Command(BaseCommand): "list of keys. This option only works when you specify one model.", ) parser.add_argument( - '-o', '--output', default=None, dest='output', + '-o', '--output', help='Specifies file to which the output is written.' ) diff --git a/django/core/management/commands/flush.py b/django/core/management/commands/flush.py index f6ae83940a..e8ed3967f7 100644 --- a/django/core/management/commands/flush.py +++ b/django/core/management/commands/flush.py @@ -20,7 +20,7 @@ class Command(BaseCommand): help='Tells Django to NOT prompt the user for input of any kind.', ) parser.add_argument( - '--database', action='store', dest='database', default=DEFAULT_DB_ALIAS, + '--database', default=DEFAULT_DB_ALIAS, help='Nominates a database to flush. Defaults to the "default" database.', ) diff --git a/django/core/management/commands/inspectdb.py b/django/core/management/commands/inspectdb.py index c84ce14739..e44b31f1c5 100644 --- a/django/core/management/commands/inspectdb.py +++ b/django/core/management/commands/inspectdb.py @@ -15,11 +15,11 @@ class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument( - 'table', action='store', nargs='*', type=str, + 'table', nargs='*', type=str, help='Selects what tables or views should be introspected.', ) parser.add_argument( - '--database', action='store', dest='database', default=DEFAULT_DB_ALIAS, + '--database', default=DEFAULT_DB_ALIAS, help='Nominates a database to introspect. Defaults to using the "default" database.', ) parser.add_argument( diff --git a/django/core/management/commands/loaddata.py b/django/core/management/commands/loaddata.py index 42dff67388..0b6a1e0898 100644 --- a/django/core/management/commands/loaddata.py +++ b/django/core/management/commands/loaddata.py @@ -39,11 +39,11 @@ class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument('args', metavar='fixture', nargs='+', help='Fixture labels.') parser.add_argument( - '--database', action='store', dest='database', default=DEFAULT_DB_ALIAS, + '--database', default=DEFAULT_DB_ALIAS, help='Nominates a specific database to load fixtures into. Defaults to the "default" database.', ) parser.add_argument( - '--app', action='store', dest='app_label', default=None, + '--app', dest='app_label', help='Only look for fixtures in the specified app.', ) parser.add_argument( @@ -52,11 +52,11 @@ class Command(BaseCommand): 'currently exist on the model.', ) parser.add_argument( - '-e', '--exclude', dest='exclude', action='append', default=[], + '-e', '--exclude', action='append', default=[], help='An app_label or app_label.ModelName to exclude. Can be used multiple times.', ) parser.add_argument( - '--format', action='store', dest='format', default=None, + '--format', help='Format of serialized data when reading from stdin.', ) diff --git a/django/core/management/commands/makemessages.py b/django/core/management/commands/makemessages.py index d0776488c3..acf8759491 100644 --- a/django/core/management/commands/makemessages.py +++ b/django/core/management/commands/makemessages.py @@ -216,20 +216,20 @@ class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument( - '--locale', '-l', default=[], dest='locale', action='append', + '--locale', '-l', default=[], action='append', help='Creates or updates the message files for the given locale(s) (e.g. pt_BR). ' 'Can be used multiple times.', ) parser.add_argument( - '--exclude', '-x', default=[], dest='exclude', action='append', + '--exclude', '-x', default=[], action='append', help='Locales to exclude. Default is none. Can be used multiple times.', ) parser.add_argument( - '--domain', '-d', default='django', dest='domain', + '--domain', '-d', default='django', help='The domain of the message files (default: "django").', ) parser.add_argument( - '--all', '-a', action='store_true', dest='all', + '--all', '-a', action='store_true', help='Updates the message files for all existing locales.', ) parser.add_argument( @@ -239,7 +239,7 @@ class Command(BaseCommand): 'commas, or use -e multiple times.', ) parser.add_argument( - '--symlinks', '-s', action='store_true', dest='symlinks', + '--symlinks', '-s', action='store_true', help='Follows symlinks to directories when examining source code ' 'and templates for translation strings.', ) @@ -254,15 +254,15 @@ class Command(BaseCommand): help="Don't ignore the common glob-style patterns 'CVS', '.*', '*~' and '*.pyc'.", ) parser.add_argument( - '--no-wrap', action='store_true', dest='no_wrap', + '--no-wrap', action='store_true', help="Don't break long message lines into several lines.", ) parser.add_argument( - '--no-location', action='store_true', dest='no_location', + '--no-location', action='store_true', help="Don't write '#: filename:line' lines.", ) parser.add_argument( - '--add-location', dest='add_location', + '--add-location', choices=('full', 'file', 'never'), const='full', nargs='?', help=( "Controls '#: filename:line' lines. If the option is 'full' " @@ -273,11 +273,11 @@ class Command(BaseCommand): ), ) parser.add_argument( - '--no-obsolete', action='store_true', dest='no_obsolete', + '--no-obsolete', action='store_true', help="Remove obsolete message strings.", ) parser.add_argument( - '--keep-pot', action='store_true', dest='keep_pot', + '--keep-pot', action='store_true', help="Keep .pot file after making messages. Useful when debugging.", ) diff --git a/django/core/management/commands/makemigrations.py b/django/core/management/commands/makemigrations.py index 51aaaef9c4..ea90467d22 100644 --- a/django/core/management/commands/makemigrations.py +++ b/django/core/management/commands/makemigrations.py @@ -29,15 +29,15 @@ class Command(BaseCommand): help='Specify the app label(s) to create migrations for.', ) parser.add_argument( - '--dry-run', action='store_true', dest='dry_run', + '--dry-run', action='store_true', help="Just show what migrations would be made; don't actually write them.", ) parser.add_argument( - '--merge', action='store_true', dest='merge', + '--merge', action='store_true', help="Enable fixing of migration conflicts.", ) parser.add_argument( - '--empty', action='store_true', dest='empty', + '--empty', action='store_true', help="Create an empty migration.", ) parser.add_argument( @@ -45,7 +45,7 @@ class Command(BaseCommand): help='Tells Django to NOT prompt the user for input of any kind.', ) parser.add_argument( - '-n', '--name', action='store', dest='name', default=None, + '-n', '--name', help="Use this name for migration file(s).", ) parser.add_argument( diff --git a/django/core/management/commands/migrate.py b/django/core/management/commands/migrate.py index 2792484b47..1e407831b4 100644 --- a/django/core/management/commands/migrate.py +++ b/django/core/management/commands/migrate.py @@ -36,22 +36,22 @@ class Command(BaseCommand): help='Tells Django to NOT prompt the user for input of any kind.', ) parser.add_argument( - '--database', action='store', dest='database', + '--database', default=DEFAULT_DB_ALIAS, help='Nominates a database to synchronize. Defaults to the "default" database.', ) parser.add_argument( - '--fake', action='store_true', dest='fake', + '--fake', action='store_true', help='Mark migrations as run without actually running them.', ) parser.add_argument( - '--fake-initial', action='store_true', dest='fake_initial', + '--fake-initial', action='store_true', help='Detect if tables already exist and fake-apply initial migrations if so. Make sure ' 'that the current database schema matches your initial migration before using this ' 'flag. Django will only check for an existing table name.', ) parser.add_argument( - '--run-syncdb', action='store_true', dest='run_syncdb', + '--run-syncdb', action='store_true', help='Creates tables for apps without migrations.', ) diff --git a/django/core/management/commands/sendtestemail.py b/django/core/management/commands/sendtestemail.py index 1be789d3dd..9ed1e9600f 100644 --- a/django/core/management/commands/sendtestemail.py +++ b/django/core/management/commands/sendtestemail.py @@ -15,11 +15,11 @@ class Command(BaseCommand): help='One or more email addresses to send a test email to.', ) parser.add_argument( - '--managers', action='store_true', dest='managers', + '--managers', action='store_true', help='Send a test email to the addresses specified in settings.MANAGERS.', ) parser.add_argument( - '--admins', action='store_true', dest='admins', + '--admins', action='store_true', help='Send a test email to the addresses specified in settings.ADMINS.', ) diff --git a/django/core/management/commands/shell.py b/django/core/management/commands/shell.py index 7c9a43434a..cff7c73f58 100644 --- a/django/core/management/commands/shell.py +++ b/django/core/management/commands/shell.py @@ -19,15 +19,15 @@ class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument( - '--no-startup', action='store_true', dest='no_startup', + '--no-startup', action='store_true', help='When using plain Python, ignore the PYTHONSTARTUP environment variable and ~/.pythonrc.py script.', ) parser.add_argument( - '-i', '--interface', choices=self.shells, dest='interface', + '-i', '--interface', choices=self.shells, help='Specify an interactive interpreter interface. Available options: "ipython", "bpython", and "python"', ) parser.add_argument( - '-c', '--command', dest='command', + '-c', '--command', help='Instead of opening an interactive shell, run a command as Django and exit.', ) diff --git a/django/core/management/commands/showmigrations.py b/django/core/management/commands/showmigrations.py index 4130d44389..c4521132c0 100644 --- a/django/core/management/commands/showmigrations.py +++ b/django/core/management/commands/showmigrations.py @@ -12,7 +12,7 @@ class Command(BaseCommand): help='App labels of applications to limit the output to.', ) parser.add_argument( - '--database', action='store', dest='database', default=DEFAULT_DB_ALIAS, + '--database', default=DEFAULT_DB_ALIAS, help='Nominates a database to synchronize. Defaults to the "default" database.', ) diff --git a/django/core/management/commands/sqlmigrate.py b/django/core/management/commands/sqlmigrate.py index 32a78da452..f0b663222a 100644 --- a/django/core/management/commands/sqlmigrate.py +++ b/django/core/management/commands/sqlmigrate.py @@ -18,7 +18,7 @@ class Command(BaseCommand): help='Nominates a database to create SQL for. Defaults to the "default" database.', ) parser.add_argument( - '--backwards', action='store_true', dest='backwards', + '--backwards', action='store_true', help='Creates SQL to unapply the migration, rather than to apply it', ) diff --git a/django/core/management/commands/squashmigrations.py b/django/core/management/commands/squashmigrations.py index 9be6750aed..6132f4e1b3 100644 --- a/django/core/management/commands/squashmigrations.py +++ b/django/core/management/commands/squashmigrations.py @@ -18,7 +18,7 @@ class Command(BaseCommand): help='App label of the application to squash migrations for.', ) parser.add_argument( - 'start_migration_name', default=None, nargs='?', + 'start_migration_name', nargs='?', help='Migrations will be squashed starting from and including this migration.', ) parser.add_argument( @@ -26,7 +26,7 @@ class Command(BaseCommand): help='Migrations will be squashed until and including this migration.', ) parser.add_argument( - '--no-optimize', action='store_true', dest='no_optimize', + '--no-optimize', action='store_true', help='Do not try to optimize the squashed operations.', ) parser.add_argument( @@ -34,7 +34,7 @@ class Command(BaseCommand): help='Tells Django to NOT prompt the user for input of any kind.', ) parser.add_argument( - '--squashed-name', dest='squashed_name', + '--squashed-name', help='Sets the name of the new squashed migration.', ) diff --git a/django/core/management/commands/test.py b/django/core/management/commands/test.py index f0a442cc47..e4f80aada3 100644 --- a/django/core/management/commands/test.py +++ b/django/core/management/commands/test.py @@ -35,11 +35,11 @@ class Command(BaseCommand): help='Tells Django to NOT prompt the user for input of any kind.', ) parser.add_argument( - '--failfast', action='store_true', dest='failfast', + '--failfast', action='store_true', help='Tells Django to stop running the test suite after first failed test.', ) parser.add_argument( - '--testrunner', action='store', dest='testrunner', + '--testrunner', help='Tells Django to use specified test runner class instead of ' 'the one specified by the TEST_RUNNER setting.', ) diff --git a/django/test/runner.py b/django/test/runner.py index 9bd9f2b506..0c31beaa2c 100644 --- a/django/test/runner.py +++ b/django/test/runner.py @@ -422,31 +422,31 @@ class DiscoverRunner: @classmethod def add_arguments(cls, parser): parser.add_argument( - '-t', '--top-level-directory', action='store', dest='top_level', default=None, + '-t', '--top-level-directory', dest='top_level', help='Top level of project for unittest discovery.', ) parser.add_argument( - '-p', '--pattern', action='store', dest='pattern', default="test*.py", + '-p', '--pattern', default="test*.py", help='The test matching pattern. Defaults to test*.py.', ) parser.add_argument( - '-k', '--keepdb', action='store_true', dest='keepdb', + '-k', '--keepdb', action='store_true', help='Preserves the test DB between runs.' ) parser.add_argument( - '-r', '--reverse', action='store_true', dest='reverse', + '-r', '--reverse', action='store_true', help='Reverses test cases order.', ) parser.add_argument( - '--debug-mode', action='store_true', dest='debug_mode', + '--debug-mode', action='store_true', help='Sets settings.DEBUG to True.', ) parser.add_argument( - '-d', '--debug-sql', action='store_true', dest='debug_sql', + '-d', '--debug-sql', action='store_true', help='Prints logged SQL queries on failure.', ) parser.add_argument( - '--parallel', dest='parallel', nargs='?', default=1, type=int, + '--parallel', nargs='?', default=1, type=int, const=default_test_processes(), metavar='N', help='Run tests using up to N parallel processes.', ) diff --git a/docs/howto/custom-management-commands.txt b/docs/howto/custom-management-commands.txt index f20252dc0c..d547bd97e2 100644 --- a/docs/howto/custom-management-commands.txt +++ b/docs/howto/custom-management-commands.txt @@ -103,7 +103,6 @@ options can be added in the :meth:`~BaseCommand.add_arguments` method like this: parser.add_argument( '--delete', action='store_true', - dest='delete', help='Delete poll instead of closing it', ) diff --git a/tests/bash_completion/management/commands/test_command.py b/tests/bash_completion/management/commands/test_command.py index 91ec36c2af..b2943d33ed 100644 --- a/tests/bash_completion/management/commands/test_command.py +++ b/tests/bash_completion/management/commands/test_command.py @@ -3,7 +3,7 @@ from django.core.management.base import BaseCommand class Command(BaseCommand): def add_arguments(self, parser): - parser.add_argument("--list", action="store_true", dest="list", help="Print all options") + parser.add_argument("--list", action="store_true", help="Print all options") def handle(self, *args, **options): pass diff --git a/tests/runtests.py b/tests/runtests.py index 9d67a15a94..88971f43a1 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -405,11 +405,11 @@ if __name__ == "__main__": help='Tells Django to NOT prompt the user for input of any kind.', ) parser.add_argument( - '--failfast', action='store_true', dest='failfast', + '--failfast', action='store_true', help='Tells Django to stop running the test suite after first failed test.', ) parser.add_argument( - '-k', '--keepdb', action='store_true', dest='keepdb', + '-k', '--keepdb', action='store_true', help='Tells Django to preserve the test database between runs.', ) parser.add_argument( @@ -433,15 +433,15 @@ if __name__ == "__main__": 'test side effects not apparent with normal execution lineup.', ) parser.add_argument( - '--selenium', dest='selenium', action=ActionSelenium, metavar='BROWSERS', + '--selenium', action=ActionSelenium, metavar='BROWSERS', help='A comma-separated list of browsers to run the Selenium tests against.', ) parser.add_argument( - '--debug-sql', action='store_true', dest='debug_sql', + '--debug-sql', action='store_true', help='Turn on the SQL query logger within tests.', ) parser.add_argument( - '--parallel', dest='parallel', nargs='?', default=0, type=int, + '--parallel', nargs='?', default=0, type=int, const=default_test_processes(), metavar='N', help='Run tests using up to N parallel processes.', ) diff --git a/tests/test_runner/runner.py b/tests/test_runner/runner.py index ac95aac403..a2c9ede897 100644 --- a/tests/test_runner/runner.py +++ b/tests/test_runner/runner.py @@ -12,9 +12,9 @@ class CustomOptionsTestRunner(DiscoverRunner): @classmethod def add_arguments(cls, parser): - parser.add_argument('--option_a', '-a', action='store', dest='option_a', default='1'), - parser.add_argument('--option_b', '-b', action='store', dest='option_b', default='2'), - parser.add_argument('--option_c', '-c', action='store', dest='option_c', default='3'), + parser.add_argument('--option_a', '-a', default='1'), + parser.add_argument('--option_b', '-b', default='2'), + parser.add_argument('--option_c', '-c', default='3'), def run_tests(self, test_labels, extra_tests=None, **kwargs): print("%s:%s:%s" % (self.option_a, self.option_b, self.option_c)) diff --git a/tests/user_commands/management/commands/hal.py b/tests/user_commands/management/commands/hal.py index 06388ab2c9..120eec961f 100644 --- a/tests/user_commands/management/commands/hal.py +++ b/tests/user_commands/management/commands/hal.py @@ -6,7 +6,7 @@ class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument('args', metavar='app_label', nargs='*', help='Specify the app label(s) to works on.') - parser.add_argument('--empty', action='store_true', dest='empty', help="Do nothing.") + parser.add_argument('--empty', action='store_true', help="Do nothing.") def handle(self, *app_labels, **options): app_labels = set(app_labels)