Used app_label instead of appname.
The last component of the dotted path to the application module is consistently referenced as the application "label". For instance it's AppConfig.label. appname could be confused with AppConfig.name, which is the full dotted path.
This commit is contained in:
parent
a7add2f296
commit
c81fae6b95
|
@ -16,10 +16,12 @@ class Command(BaseCommand):
|
||||||
make_option('--indent', default=None, dest='indent', type='int',
|
make_option('--indent', default=None, dest='indent', type='int',
|
||||||
help='Specifies the indent level to use when pretty-printing output'),
|
help='Specifies the indent level to use when pretty-printing output'),
|
||||||
make_option('--database', action='store', dest='database',
|
make_option('--database', action='store', dest='database',
|
||||||
default=DEFAULT_DB_ALIAS, help='Nominates a specific database to dump '
|
default=DEFAULT_DB_ALIAS,
|
||||||
'fixtures from. Defaults to the "default" database.'),
|
help='Nominates a specific database to dump fixtures from. '
|
||||||
|
'Defaults to the "default" database.'),
|
||||||
make_option('-e', '--exclude', dest='exclude', action='append', default=[],
|
make_option('-e', '--exclude', dest='exclude', action='append', default=[],
|
||||||
help='An appname or appname.ModelName to exclude (use multiple --exclude to exclude multiple apps/models).'),
|
help='An app_label or app_label.ModelName to exclude '
|
||||||
|
'(use multiple --exclude to exclude multiple apps/models).'),
|
||||||
make_option('-n', '--natural', action='store_true', dest='use_natural_keys', default=False,
|
make_option('-n', '--natural', action='store_true', dest='use_natural_keys', default=False,
|
||||||
help='Use natural keys if they are available.'),
|
help='Use natural keys if they are available.'),
|
||||||
make_option('--natural-foreign', action='store_true', dest='use_natural_foreign_keys', default=False,
|
make_option('--natural-foreign', action='store_true', dest='use_natural_foreign_keys', default=False,
|
||||||
|
@ -27,15 +29,17 @@ class Command(BaseCommand):
|
||||||
make_option('--natural-primary', action='store_true', dest='use_natural_primary_keys', default=False,
|
make_option('--natural-primary', action='store_true', dest='use_natural_primary_keys', default=False,
|
||||||
help='Use natural primary keys if they are available.'),
|
help='Use natural primary keys if they are available.'),
|
||||||
make_option('-a', '--all', action='store_true', dest='use_base_manager', default=False,
|
make_option('-a', '--all', action='store_true', dest='use_base_manager', default=False,
|
||||||
help="Use Django's base manager to dump all models stored in the database, including those that would otherwise be filtered or modified by a custom manager."),
|
help="Use Django's base manager to dump all models stored in the database, "
|
||||||
make_option('--pks', dest='primary_keys', help="Only dump objects with "
|
"including those that would otherwise be filtered or modified by a custom manager."),
|
||||||
"given primary keys. Accepts a comma separated list of keys. "
|
make_option('--pks', dest='primary_keys',
|
||||||
|
help="Only dump objects with given primary keys. "
|
||||||
|
"Accepts a comma separated list of keys. "
|
||||||
"This option will only work when you specify one model."),
|
"This option will only work when you specify one model."),
|
||||||
)
|
)
|
||||||
help = ("Output the contents of the database as a fixture of the given "
|
help = ("Output the contents of the database as a fixture of the given "
|
||||||
"format (using each model's default manager unless --all is "
|
"format (using each model's default manager unless --all is "
|
||||||
"specified).")
|
"specified).")
|
||||||
args = '[appname appname.ModelName ...]'
|
args = '[app_label app_label.ModelName ...]'
|
||||||
|
|
||||||
def handle(self, *app_labels, **options):
|
def handle(self, *app_labels, **options):
|
||||||
format = options.get('format')
|
format = options.get('format')
|
||||||
|
|
|
@ -45,7 +45,7 @@ class Command(NoArgsCommand):
|
||||||
yield "# * Remove `managed = False` lines for those models you wish to give write DB access"
|
yield "# * Remove `managed = False` lines for those models you wish to give write DB access"
|
||||||
yield "# Feel free to rename the models, but don't rename db_table values or field names."
|
yield "# Feel free to rename the models, but don't rename db_table values or field names."
|
||||||
yield "#"
|
yield "#"
|
||||||
yield "# Also note: You'll have to insert the output of 'django-admin.py sqlcustom [appname]'"
|
yield "# Also note: You'll have to insert the output of 'django-admin.py sqlcustom [app_label]'"
|
||||||
yield "# into your database."
|
yield "# into your database."
|
||||||
yield "from __future__ import unicode_literals"
|
yield "from __future__ import unicode_literals"
|
||||||
yield ''
|
yield ''
|
||||||
|
|
|
@ -75,7 +75,7 @@ class Command(BaseCommand):
|
||||||
run_syncdb = False
|
run_syncdb = False
|
||||||
target_app_labels_only = True
|
target_app_labels_only = True
|
||||||
if len(args) > 2:
|
if len(args) > 2:
|
||||||
raise CommandError("Too many command-line arguments (expecting 'appname' or 'appname migrationname')")
|
raise CommandError("Too many command-line arguments (expecting 'app_label' or 'app_label migrationname')")
|
||||||
elif len(args) == 2:
|
elif len(args) == 2:
|
||||||
app_label, migration_name = args
|
app_label, migration_name = args
|
||||||
if app_label not in executor.loader.migrated_apps:
|
if app_label not in executor.loader.migrated_apps:
|
||||||
|
|
|
@ -31,7 +31,7 @@ class Command(BaseCommand):
|
||||||
|
|
||||||
# Resolve command-line arguments into a migration
|
# Resolve command-line arguments into a migration
|
||||||
if len(args) != 2:
|
if len(args) != 2:
|
||||||
raise CommandError("Wrong number of arguments (expecting 'sqlmigrate appname migrationname')")
|
raise CommandError("Wrong number of arguments (expecting 'sqlmigrate app_label migrationname')")
|
||||||
else:
|
else:
|
||||||
app_label, migration_name = args
|
app_label, migration_name = args
|
||||||
if app_label not in executor.loader.migrated_apps:
|
if app_label not in executor.loader.migrated_apps:
|
||||||
|
|
|
@ -22,7 +22,7 @@ class MigrationExecutor(object):
|
||||||
plan = []
|
plan = []
|
||||||
applied = set(self.loader.applied_migrations)
|
applied = set(self.loader.applied_migrations)
|
||||||
for target in targets:
|
for target in targets:
|
||||||
# If the target is (appname, None), that means unmigrate everything
|
# If the target is (app_label, None), that means unmigrate everything
|
||||||
if target[1] is None:
|
if target[1] is None:
|
||||||
for root in self.loader.graph.root_nodes():
|
for root in self.loader.graph.root_nodes():
|
||||||
if root[0] == target[0]:
|
if root[0] == target[0]:
|
||||||
|
|
|
@ -1149,7 +1149,7 @@ DEFAULT_URLCONF_TEMPLATE = """
|
||||||
<div id="instructions">
|
<div id="instructions">
|
||||||
<p>
|
<p>
|
||||||
Of course, you haven't actually done any work yet.
|
Of course, you haven't actually done any work yet.
|
||||||
Next, start your first app by running <code>python manage.py startapp [appname]</code>.
|
Next, start your first app by running <code>python manage.py startapp [app_label]</code>.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -199,8 +199,8 @@ All attributes can be set in your derived class and can be used in
|
||||||
|
|
||||||
A string listing the arguments accepted by the command,
|
A string listing the arguments accepted by the command,
|
||||||
suitable for use in help messages; e.g., a command which takes
|
suitable for use in help messages; e.g., a command which takes
|
||||||
a list of application names might set this to '<appname
|
a list of application names might set this to '<app_label
|
||||||
appname ...>'.
|
app_label ...>'.
|
||||||
|
|
||||||
.. attribute:: BaseCommand.can_import_settings
|
.. attribute:: BaseCommand.can_import_settings
|
||||||
|
|
||||||
|
|
|
@ -150,13 +150,13 @@ Database-backend-specific SQL data
|
||||||
There's also a hook for backend-specific SQL data. For example, you
|
There's also a hook for backend-specific SQL data. For example, you
|
||||||
can have separate initial-data files for PostgreSQL and SQLite. For
|
can have separate initial-data files for PostgreSQL and SQLite. For
|
||||||
each app, Django looks for a file called
|
each app, Django looks for a file called
|
||||||
``<appname>/sql/<modelname>.<backend>.sql``, where ``<appname>`` is
|
``<app_label>/sql/<modelname>.<backend>.sql``, where ``<app_label>`` is
|
||||||
your app directory, ``<modelname>`` is the model's name in lowercase
|
your app directory, ``<modelname>`` is the model's name in lowercase
|
||||||
and ``<backend>`` is the last part of the module name provided for the
|
and ``<backend>`` is the last part of the module name provided for the
|
||||||
:setting:`ENGINE <DATABASE-ENGINE>` in your settings file (e.g., if you have
|
:setting:`ENGINE <DATABASE-ENGINE>` in your settings file (e.g., if you have
|
||||||
defined a database with an :setting:`ENGINE <DATABASE-ENGINE>` value of
|
defined a database with an :setting:`ENGINE <DATABASE-ENGINE>` value of
|
||||||
``django.db.backends.sqlite3``, Django will look for
|
``django.db.backends.sqlite3``, Django will look for
|
||||||
``<appname>/sql/<modelname>.sqlite3.sql``).
|
``<app_label>/sql/<modelname>.sqlite3.sql``).
|
||||||
|
|
||||||
Backend-specific SQL data is executed before non-backend-specific SQL
|
Backend-specific SQL data is executed before non-backend-specific SQL
|
||||||
data. For example, if your app contains the files ``sql/person.sql``
|
data. For example, if your app contains the files ``sql/person.sql``
|
||||||
|
|
|
@ -40,7 +40,7 @@ Displays differences between the current
|
||||||
and Django's default settings. Settings that don't appear in the defaults are
|
and Django's default settings. Settings that don't appear in the defaults are
|
||||||
followed by "###".
|
followed by "###".
|
||||||
.TP
|
.TP
|
||||||
.BI "dumpdata [" "\-\-all" "] [" "\-\-format=FMT" "] [" "\-\-indent=NUM" "] [" "\-\-natural=NATURAL" "] [" "appname appname appname.Model ..." "]"
|
.BI "dumpdata [" "\-\-all" "] [" "\-\-format=FMT" "] [" "\-\-indent=NUM" "] [" "\-\-natural=NATURAL" "] [" "app_label app_label app_label.Model ..." "]"
|
||||||
Outputs to standard output all data in the database associated with the named
|
Outputs to standard output all data in the database associated with the named
|
||||||
application(s).
|
application(s).
|
||||||
.TP
|
.TP
|
||||||
|
@ -54,7 +54,7 @@ model module.
|
||||||
.BI "loaddata [" "fixture fixture ..." "]"
|
.BI "loaddata [" "fixture fixture ..." "]"
|
||||||
Searches for and loads the contents of the named fixture into the database.
|
Searches for and loads the contents of the named fixture into the database.
|
||||||
.TP
|
.TP
|
||||||
.BI "install [" "appname ..." "]"
|
.BI "install [" "app_label ..." "]"
|
||||||
Executes
|
Executes
|
||||||
.B sqlall
|
.B sqlall
|
||||||
for the given app(s) in the current database.
|
for the given app(s) in the current database.
|
||||||
|
@ -79,33 +79,33 @@ The
|
||||||
option forces the use of the standard Python interpreter even when IPython is
|
option forces the use of the standard Python interpreter even when IPython is
|
||||||
installed.
|
installed.
|
||||||
.TP
|
.TP
|
||||||
.BI "sql [" "appname ..." "]"
|
.BI "sql [" "app_label ..." "]"
|
||||||
Prints the CREATE TABLE SQL statements for the given app name(s).
|
Prints the CREATE TABLE SQL statements for the given app name(s).
|
||||||
.TP
|
.TP
|
||||||
.BI "sqlall [" "appname ..." "]"
|
.BI "sqlall [" "app_label ..." "]"
|
||||||
Prints the CREATE TABLE, initial\-data and CREATE INDEX SQL statements for the
|
Prints the CREATE TABLE, initial\-data and CREATE INDEX SQL statements for the
|
||||||
given model module name(s).
|
given model module name(s).
|
||||||
.TP
|
.TP
|
||||||
.BI "sqlclear [" "appname ..." "]"
|
.BI "sqlclear [" "app_label ..." "]"
|
||||||
Prints the DROP TABLE SQL statements for the given app name(s).
|
Prints the DROP TABLE SQL statements for the given app name(s).
|
||||||
.TP
|
.TP
|
||||||
.BI "sqlcustom [" "appname ..." "]"
|
.BI "sqlcustom [" "app_label ..." "]"
|
||||||
Prints the custom SQL statements for the given app name(s).
|
Prints the custom SQL statements for the given app name(s).
|
||||||
.TP
|
.TP
|
||||||
.BI "sqlflush [" "appname ..." "]"
|
.BI "sqlflush [" "app_label ..." "]"
|
||||||
Prints the SQL statements that would be executed for the "flush" command.
|
Prints the SQL statements that would be executed for the "flush" command.
|
||||||
.TP
|
.TP
|
||||||
.BI "sqlindexes [" "appname ..." "]"
|
.BI "sqlindexes [" "app_label ..." "]"
|
||||||
Prints the CREATE INDEX SQL statements for the given model module name(s).
|
Prints the CREATE INDEX SQL statements for the given model module name(s).
|
||||||
.TP
|
.TP
|
||||||
.BI "sqlinitialdata [" "appname ..." "]"
|
.BI "sqlinitialdata [" "app_label ..." "]"
|
||||||
Prints the initial INSERT SQL statements for the given app name(s).
|
Prints the initial INSERT SQL statements for the given app name(s).
|
||||||
.TP
|
.TP
|
||||||
.BI "sqlsequencereset [" "appname ..." "]"
|
.BI "sqlsequencereset [" "app_label ..." "]"
|
||||||
Prints the SQL statements for resetting PostgreSQL sequences for the
|
Prints the SQL statements for resetting PostgreSQL sequences for the
|
||||||
given app name(s).
|
given app name(s).
|
||||||
.TP
|
.TP
|
||||||
.BI "startapp [" "\-\-template=PATH_OR_URL" "] [" "\-\-extension=EXTENSION" "] [" "\-\-name=FILENAME" "] [" "appname" "] [" "destination" "]"
|
.BI "startapp [" "\-\-template=PATH_OR_URL" "] [" "\-\-extension=EXTENSION" "] [" "\-\-name=FILENAME" "] [" "app_label" "] [" "destination" "]"
|
||||||
Creates a Django app directory structure for the given app name in
|
Creates a Django app directory structure for the given app name in
|
||||||
the current directory or the optional destination.
|
the current directory or the optional destination.
|
||||||
.TP
|
.TP
|
||||||
|
@ -117,7 +117,7 @@ in the current directory or the optional destination.
|
||||||
Runs migrations for apps containing migrations, and just creates missing tables
|
Runs migrations for apps containing migrations, and just creates missing tables
|
||||||
for apps without migrations.
|
for apps without migrations.
|
||||||
.TP
|
.TP
|
||||||
.BI "test [" "\-\-verbosity" "] [" "\-\-failfast" "] [" "appname ..." "]"
|
.BI "test [" "\-\-verbosity" "] [" "\-\-failfast" "] [" "app_label ..." "]"
|
||||||
Runs the test suite for the specified applications, or the entire project if
|
Runs the test suite for the specified applications, or the entire project if
|
||||||
no apps are specified
|
no apps are specified
|
||||||
.TP
|
.TP
|
||||||
|
|
|
@ -44,8 +44,8 @@ hyperlinks to other components:
|
||||||
================= =======================
|
================= =======================
|
||||||
Django Component reStructuredText roles
|
Django Component reStructuredText roles
|
||||||
================= =======================
|
================= =======================
|
||||||
Models ``:model:`appname.ModelName```
|
Models ``:model:`app_label.ModelName```
|
||||||
Views ``:view:`appname.view_name```
|
Views ``:view:`app_label.view_name```
|
||||||
Template tags ``:tag:`tagname```
|
Template tags ``:tag:`tagname```
|
||||||
Template filters ``:filter:`filtername```
|
Template filters ``:filter:`filtername```
|
||||||
Templates ``:template:`path/to/template.html```
|
Templates ``:template:`path/to/template.html```
|
||||||
|
|
|
@ -183,8 +183,8 @@ if they have Django's default value. Such settings are prefixed by ``"###"``.
|
||||||
|
|
||||||
The :djadminopt:`--all` option was added.
|
The :djadminopt:`--all` option was added.
|
||||||
|
|
||||||
dumpdata <appname appname appname.Model ...>
|
dumpdata <app_label app_label app_label.Model ...>
|
||||||
--------------------------------------------
|
--------------------------------------------------
|
||||||
|
|
||||||
.. django-admin:: dumpdata
|
.. django-admin:: dumpdata
|
||||||
|
|
||||||
|
@ -217,10 +217,10 @@ easy for humans to read, so you can use the ``--indent`` option to
|
||||||
pretty-print the output with a number of indentation spaces.
|
pretty-print the output with a number of indentation spaces.
|
||||||
|
|
||||||
The :djadminopt:`--exclude` option may be provided to prevent specific
|
The :djadminopt:`--exclude` option may be provided to prevent specific
|
||||||
applications or models (specified as in the form of ``appname.ModelName``) from
|
applications or models (specified as in the form of ``app_label.ModelName``)
|
||||||
being dumped. If you specify a model name to ``dumpdata``, the dumped output
|
from being dumped. If you specify a model name to ``dumpdata``, the dumped
|
||||||
will be restricted to that model, rather than the entire application. You can
|
output will be restricted to that model, rather than the entire application.
|
||||||
also mix application names and model names.
|
You can also mix application names and model names.
|
||||||
|
|
||||||
The :djadminopt:`--database` option can be used to specify the database
|
The :djadminopt:`--database` option can be used to specify the database
|
||||||
from which data will be dumped.
|
from which data will be dumped.
|
||||||
|
@ -398,7 +398,7 @@ directories will be included in the search path. For example::
|
||||||
|
|
||||||
django-admin.py loaddata foo/bar/mydata.json
|
django-admin.py loaddata foo/bar/mydata.json
|
||||||
|
|
||||||
would search ``<appname>/fixtures/foo/bar/mydata.json`` for each installed
|
would search ``<app_label>/fixtures/foo/bar/mydata.json`` for each installed
|
||||||
application, ``<dirname>/foo/bar/mydata.json`` for each directory in
|
application, ``<dirname>/foo/bar/mydata.json`` for each directory in
|
||||||
:setting:`FIXTURE_DIRS`, and the literal path ``foo/bar/mydata.json``.
|
:setting:`FIXTURE_DIRS`, and the literal path ``foo/bar/mydata.json``.
|
||||||
|
|
||||||
|
@ -587,8 +587,8 @@ Use the ``--keep-pot`` option to prevent Django from deleting the temporary
|
||||||
.pot files it generates before creating the .po file. This is useful for
|
.pot files it generates before creating the .po file. This is useful for
|
||||||
debugging errors which may prevent the final language files from being created.
|
debugging errors which may prevent the final language files from being created.
|
||||||
|
|
||||||
makemigrations [<appname>]
|
makemigrations [<app_label>]
|
||||||
--------------------------
|
----------------------------
|
||||||
|
|
||||||
.. django-admin:: makemigrations
|
.. django-admin:: makemigrations
|
||||||
|
|
||||||
|
@ -610,8 +610,8 @@ for advanced users and should not be used unless you are familiar with
|
||||||
the migration format, migration operations, and the dependencies between
|
the migration format, migration operations, and the dependencies between
|
||||||
your migrations.
|
your migrations.
|
||||||
|
|
||||||
migrate [<appname> [<migrationname>]]
|
migrate [<app_label> [<migrationname>]]
|
||||||
-------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
.. django-admin:: migrate
|
.. django-admin:: migrate
|
||||||
|
|
||||||
|
@ -625,10 +625,10 @@ The behavior of this command changes depending on the arguments provided:
|
||||||
|
|
||||||
* No arguments: All migrated apps have all of their migrations run,
|
* No arguments: All migrated apps have all of their migrations run,
|
||||||
and all unmigrated apps are synchronized with the database,
|
and all unmigrated apps are synchronized with the database,
|
||||||
* ``<appname>``: The specified app has its migrations run, up to the most
|
* ``<app_label>``: The specified app has its migrations run, up to the most
|
||||||
recent migration. This may involve running other apps' migrations too, due
|
recent migration. This may involve running other apps' migrations too, due
|
||||||
to dependencies.
|
to dependencies.
|
||||||
* ``<appname> <migrationname>``: Brings the database schema to a state where it
|
* ``<app_label> <migrationname>``: Brings the database schema to a state where it
|
||||||
would have just run the given migration, but no further - this may involve
|
would have just run the given migration, but no further - this may involve
|
||||||
unapplying migrations if you have previously migrated past the named
|
unapplying migrations if you have previously migrated past the named
|
||||||
migration. Use the name `zero` to unapply all migrations for an app.
|
migration. Use the name `zero` to unapply all migrations for an app.
|
||||||
|
@ -942,8 +942,8 @@ behavior you can use the ``--no-startup`` option. e.g.::
|
||||||
|
|
||||||
The ``--no-startup`` option was added in Django 1.6.
|
The ``--no-startup`` option was added in Django 1.6.
|
||||||
|
|
||||||
sql <appname appname ...>
|
sql <app_label app_label ...>
|
||||||
-------------------------
|
-----------------------------
|
||||||
|
|
||||||
.. django-admin:: sql
|
.. django-admin:: sql
|
||||||
|
|
||||||
|
@ -952,8 +952,8 @@ Prints the CREATE TABLE SQL statements for the given app name(s).
|
||||||
The :djadminopt:`--database` option can be used to specify the database for
|
The :djadminopt:`--database` option can be used to specify the database for
|
||||||
which to print the SQL.
|
which to print the SQL.
|
||||||
|
|
||||||
sqlall <appname appname ...>
|
sqlall <app_label app_label ...>
|
||||||
----------------------------
|
--------------------------------
|
||||||
|
|
||||||
.. django-admin:: sqlall
|
.. django-admin:: sqlall
|
||||||
|
|
||||||
|
@ -965,8 +965,8 @@ specify initial data.
|
||||||
The :djadminopt:`--database` option can be used to specify the database for
|
The :djadminopt:`--database` option can be used to specify the database for
|
||||||
which to print the SQL.
|
which to print the SQL.
|
||||||
|
|
||||||
sqlclear <appname appname ...>
|
sqlclear <app_label app_label ...>
|
||||||
------------------------------
|
----------------------------------
|
||||||
|
|
||||||
.. django-admin:: sqlclear
|
.. django-admin:: sqlclear
|
||||||
|
|
||||||
|
@ -975,19 +975,19 @@ Prints the DROP TABLE SQL statements for the given app name(s).
|
||||||
The :djadminopt:`--database` option can be used to specify the database for
|
The :djadminopt:`--database` option can be used to specify the database for
|
||||||
which to print the SQL.
|
which to print the SQL.
|
||||||
|
|
||||||
sqlcustom <appname appname ...>
|
sqlcustom <app_label app_label ...>
|
||||||
-------------------------------
|
-----------------------------------
|
||||||
|
|
||||||
.. django-admin:: sqlcustom
|
.. django-admin:: sqlcustom
|
||||||
|
|
||||||
Prints the custom SQL statements for the given app name(s).
|
Prints the custom SQL statements for the given app name(s).
|
||||||
|
|
||||||
For each model in each specified app, this command looks for the file
|
For each model in each specified app, this command looks for the file
|
||||||
``<appname>/sql/<modelname>.sql``, where ``<appname>`` is the given app name and
|
``<app_label>/sql/<modelname>.sql``, where ``<app_label>`` is the given app
|
||||||
``<modelname>`` is the model's name in lowercase. For example, if you have an
|
name and ``<modelname>`` is the model's name in lowercase. For example, if you
|
||||||
app ``news`` that includes a ``Story`` model, ``sqlcustom`` will attempt
|
have an app ``news`` that includes a ``Story`` model, ``sqlcustom`` will
|
||||||
to read a file ``news/sql/story.sql`` and append it to the output of this
|
attempt to read a file ``news/sql/story.sql`` and append it to the output of
|
||||||
command.
|
this command.
|
||||||
|
|
||||||
Each of the SQL files, if given, is expected to contain valid SQL. The SQL
|
Each of the SQL files, if given, is expected to contain valid SQL. The SQL
|
||||||
files are piped directly into the database after all of the models'
|
files are piped directly into the database after all of the models'
|
||||||
|
@ -999,8 +999,8 @@ Note that the order in which the SQL files are processed is undefined.
|
||||||
The :djadminopt:`--database` option can be used to specify the database for
|
The :djadminopt:`--database` option can be used to specify the database for
|
||||||
which to print the SQL.
|
which to print the SQL.
|
||||||
|
|
||||||
sqldropindexes <appname appname ...>
|
sqldropindexes <app_label app_label ...>
|
||||||
------------------------------------
|
----------------------------------------
|
||||||
|
|
||||||
.. django-admin:: sqldropindexes
|
.. django-admin:: sqldropindexes
|
||||||
|
|
||||||
|
@ -1022,8 +1022,8 @@ command.
|
||||||
The :djadminopt:`--database` option can be used to specify the database for
|
The :djadminopt:`--database` option can be used to specify the database for
|
||||||
which to print the SQL.
|
which to print the SQL.
|
||||||
|
|
||||||
sqlindexes <appname appname ...>
|
sqlindexes <app_label app_label ...>
|
||||||
--------------------------------
|
------------------------------------
|
||||||
|
|
||||||
.. django-admin:: sqlindexes
|
.. django-admin:: sqlindexes
|
||||||
|
|
||||||
|
@ -1032,8 +1032,8 @@ Prints the CREATE INDEX SQL statements for the given app name(s).
|
||||||
The :djadminopt:`--database` option can be used to specify the database for
|
The :djadminopt:`--database` option can be used to specify the database for
|
||||||
which to print the SQL.
|
which to print the SQL.
|
||||||
|
|
||||||
sqlmigrate <appname> <migrationname>
|
sqlmigrate <app_label> <migrationname>
|
||||||
------------------------------------
|
--------------------------------------
|
||||||
|
|
||||||
.. django-admin:: sqlmigrate
|
.. django-admin:: sqlmigrate
|
||||||
|
|
||||||
|
@ -1050,8 +1050,8 @@ By default, the SQL created is for running the migration in the forwards
|
||||||
direction. Pass ``--backwards`` to generate the SQL for
|
direction. Pass ``--backwards`` to generate the SQL for
|
||||||
un-applying the migration instead.
|
un-applying the migration instead.
|
||||||
|
|
||||||
sqlsequencereset <appname appname ...>
|
sqlsequencereset <app_label app_label ...>
|
||||||
--------------------------------------
|
------------------------------------------
|
||||||
|
|
||||||
.. django-admin:: sqlsequencereset
|
.. django-admin:: sqlsequencereset
|
||||||
|
|
||||||
|
@ -1066,8 +1066,8 @@ of sync with its automatically incremented field data.
|
||||||
The :djadminopt:`--database` option can be used to specify the database for
|
The :djadminopt:`--database` option can be used to specify the database for
|
||||||
which to print the SQL.
|
which to print the SQL.
|
||||||
|
|
||||||
startapp <appname> [destination]
|
startapp <app_label> [destination]
|
||||||
--------------------------------
|
----------------------------------
|
||||||
|
|
||||||
.. django-admin:: startapp
|
.. django-admin:: startapp
|
||||||
|
|
||||||
|
|
|
@ -264,7 +264,7 @@ If your app already has models and database tables, and doesn't have migrations
|
||||||
yet (for example, you created it against a previous Django version), you'll
|
yet (for example, you created it against a previous Django version), you'll
|
||||||
need to convert it to use migrations; this is a simple process::
|
need to convert it to use migrations; this is a simple process::
|
||||||
|
|
||||||
$ python manage.py makemigrations yourappname
|
$ python manage.py makemigrations your_app_label
|
||||||
|
|
||||||
This will make a new initial migration for your app. Now, when you run
|
This will make a new initial migration for your app. Now, when you run
|
||||||
:djadmin:`migrate`, Django will detect that you have an initial migration
|
:djadmin:`migrate`, Django will detect that you have an initial migration
|
||||||
|
|
|
@ -4,7 +4,7 @@ from django.core.management.base import AppCommand
|
||||||
class Command(AppCommand):
|
class Command(AppCommand):
|
||||||
help = 'Test Application-based commands'
|
help = 'Test Application-based commands'
|
||||||
requires_model_validation = False
|
requires_model_validation = False
|
||||||
args = '[appname ...]'
|
args = '[app_label ...]'
|
||||||
|
|
||||||
def handle_app_config(self, app_config, **options):
|
def handle_app_config(self, app_config, **options):
|
||||||
print('EXECUTE:AppCommand name=%s, options=%s' % (app_config.name, sorted(options.items())))
|
print('EXECUTE:AppCommand name=%s, options=%s' % (app_config.name, sorted(options.items())))
|
||||||
|
|
|
@ -1435,13 +1435,13 @@ class CommandTypes(AdminScriptTestCase):
|
||||||
self.assertOutput(out, "EXECUTE:AppCommand name=django.contrib.contenttypes, options=")
|
self.assertOutput(out, "EXECUTE:AppCommand name=django.contrib.contenttypes, options=")
|
||||||
self.assertOutput(out, str_prefix(", options=[('no_color', False), ('pythonpath', None), ('settings', None), ('traceback', None), ('verbosity', %(_)s'1')]"))
|
self.assertOutput(out, str_prefix(", options=[('no_color', False), ('pythonpath', None), ('settings', None), ('traceback', None), ('verbosity', %(_)s'1')]"))
|
||||||
|
|
||||||
def test_app_command_invalid_appname(self):
|
def test_app_command_invalid_app_label(self):
|
||||||
"User AppCommands can execute when a single app name is provided"
|
"User AppCommands can execute when a single app name is provided"
|
||||||
args = ['app_command', 'NOT_AN_APP']
|
args = ['app_command', 'NOT_AN_APP']
|
||||||
out, err = self.run_manage(args)
|
out, err = self.run_manage(args)
|
||||||
self.assertOutput(err, "No installed app with label 'NOT_AN_APP'.")
|
self.assertOutput(err, "No installed app with label 'NOT_AN_APP'.")
|
||||||
|
|
||||||
def test_app_command_some_invalid_appnames(self):
|
def test_app_command_some_invalid_app_labels(self):
|
||||||
"User AppCommands can execute when some of the provided app names are invalid"
|
"User AppCommands can execute when some of the provided app names are invalid"
|
||||||
args = ['app_command', 'auth', 'NOT_AN_APP']
|
args = ['app_command', 'auth', 'NOT_AN_APP']
|
||||||
out, err = self.run_manage(args)
|
out, err = self.run_manage(args)
|
||||||
|
|
Loading…
Reference in New Issue