From 59b204526ee03e936876365f1c8b5d856c5b8770 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Fri, 2 Sep 2005 18:26:16 +0000 Subject: [PATCH] Fixed #454 -- Clarified django-admin '--help' output to use 'modelmodule' instead of 'app'. Thanks, Maniac git-svn-id: http://code.djangoproject.com/svn/django/trunk@607 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/core/management.py | 24 ++++++++++----------- docs/django-admin.txt | 44 +++++++++++++++++++-------------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/django/core/management.py b/django/core/management.py index 69188b53fe..74733a7a4b 100644 --- a/django/core/management.py +++ b/django/core/management.py @@ -12,7 +12,7 @@ MODULE_TEMPLATE = ''' {%% if perms.%(app)s.%(addperm)s or perms.%(app)s.%(cha {%% endif %%}''' -APP_ARGS = '[app app ...]' +APP_ARGS = '[modelmodule ...]' # Use django.__path__[0] because we don't know which directory django into # which has been installed. @@ -101,7 +101,7 @@ def get_sql_create(mod): table_output.append(');') final_output.append('\n'.join(table_output)) return final_output -get_sql_create.help_doc = "Prints the CREATE TABLE SQL statements for the given app(s)." +get_sql_create.help_doc = "Prints the CREATE TABLE SQL statements for the given model module name(s)." get_sql_create.args = APP_ARGS def get_sql_delete(mod): @@ -147,13 +147,13 @@ def get_sql_delete(mod): output.append("DELETE FROM auth_admin_log WHERE content_type_id = %s;" % row[0]) return output[::-1] # Reverse it, to deal with table dependencies. -get_sql_delete.help_doc = "Prints the DROP TABLE SQL statements for the given app(s)." +get_sql_delete.help_doc = "Prints the DROP TABLE SQL statements for the given model module name(s)." get_sql_delete.args = APP_ARGS def get_sql_reset(mod): "Returns a list of the DROP TABLE SQL, then the CREATE TABLE SQL, for the given module." return get_sql_delete(mod) + get_sql_all(mod) -get_sql_reset.help_doc = "Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for the given app(s)." +get_sql_reset.help_doc = "Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for the given model module name(s)." get_sql_reset.args = APP_ARGS def get_sql_initial_data(mod): @@ -176,7 +176,7 @@ def get_sql_initial_data(mod): for codename, name in _get_all_permissions(opts): output.append(_get_permission_insert(name, codename, opts)) return output -get_sql_initial_data.help_doc = "Prints the initial INSERT SQL statements for the given app(s)." +get_sql_initial_data.help_doc = "Prints the initial INSERT SQL statements for the given model module name(s)." get_sql_initial_data.args = APP_ARGS def get_sql_sequence_reset(mod): @@ -188,7 +188,7 @@ def get_sql_sequence_reset(mod): if isinstance(f, meta.AutoField): output.append("SELECT setval('%s_%s_seq', (SELECT max(%s) FROM %s));" % (klass._meta.db_table, f.column, f.column, klass._meta.db_table)) return output -get_sql_sequence_reset.help_doc = "Prints the SQL statements for resetting PostgreSQL sequences for the given app(s)." +get_sql_sequence_reset.help_doc = "Prints the SQL statements for resetting PostgreSQL sequences for the given model module name(s)." get_sql_sequence_reset.args = APP_ARGS def get_sql_indexes(mod): @@ -201,13 +201,13 @@ def get_sql_indexes(mod): output.append("CREATE %sINDEX %s_%s ON %s (%s);" % \ (unique, klass._meta.db_table, f.column, klass._meta.db_table, f.column)) return output -get_sql_indexes.help_doc = "Prints the CREATE INDEX SQL statements for the given app(s)." +get_sql_indexes.help_doc = "Prints the CREATE INDEX SQL statements for the given model module name(s)." get_sql_indexes.args = APP_ARGS def get_sql_all(mod): "Returns a list of CREATE TABLE SQL and initial-data insert for the given module." return get_sql_create(mod) + get_sql_initial_data(mod) -get_sql_all.help_doc = "Prints the CREATE TABLE and initial-data SQL statements for the given app(s)." +get_sql_all.help_doc = "Prints the CREATE TABLE and initial-data SQL statements for the given model module name(s)." get_sql_all.args = APP_ARGS def database_check(mod): @@ -259,7 +259,7 @@ def database_check(mod): except KeyError: # sys.stderr.write("A content type called '%s.%s' was found in the database but not in the model.\n" % (app_label, row[0])) print "DELETE FROM content_types WHERE package='%s' AND python_module_name = '%s';" % (app_label, row[0]) -database_check.help_doc = "Checks that everything is installed in the database for the given app(s) and prints SQL statements if needed." +database_check.help_doc = "Checks that everything is installed in the database for the given model module name(s) and prints SQL statements if needed." database_check.args = APP_ARGS def get_admin_index(mod): @@ -281,7 +281,7 @@ def get_admin_index(mod): output.append('') output.append('{% endif %}') return output -get_admin_index.help_doc = "Prints the admin-index template snippet for the given app(s)." +get_admin_index.help_doc = "Prints the admin-index template snippet for the given model module name(s)." get_admin_index.args = APP_ARGS def init(): @@ -321,7 +321,7 @@ The full error: %s\n""" % \ db.db.rollback() sys.exit(1) db.db.commit() -install.help_doc = "Executes ``sqlall`` for the given app(s) in the current database." +install.help_doc = "Executes ``sqlall`` for the given model module name(s) in the current database." install.args = APP_ARGS def _start_helper(app_or_project, name, directory, other_name=''): @@ -376,7 +376,7 @@ startproject.help_doc = "Creates a Django project directory structure for the gi startproject.args = "[projectname]" def startapp(app_name, directory): - "Creates a Django app for the given project_name in the given directory." + "Creates a Django app for the given app_name in the given directory." # Determine the project_name a bit naively -- by looking at the name of # the parent directory. project_dir = os.path.normpath(os.path.join(directory, '../')) diff --git a/docs/django-admin.txt b/docs/django-admin.txt index 6ac15341b9..f50f50962f 100644 --- a/docs/django-admin.txt +++ b/docs/django-admin.txt @@ -22,18 +22,18 @@ document. Run ``django-admin.py --help`` to display a help message that includes a terse list of all available actions and options. -Most actions take a list of "app"s. An "app," in this case, is the name of -a file containing Django models. For example, if you have a model module called -``myproject/apps/polls/pollmodels.py``, the "app" in this case would be -``"pollmodels"``. +Most actions take a list of "modelmodule"s. A "modelmodule," in this case, is +the name of a file containing Django models. For example, if you have a model +module called ``myproject/apps/polls/pollmodels.py``, the "modelmodule" in this +case would be ``"pollmodels"``. Available actions ================= -adminindex [app app ...] +adminindex [modelmodule modelmodule ...] ------------------------ -Prints the admin-index template snippet for the given app(s). +Prints the admin-index template snippet for the given model module(s). Use admin-index template snippets if you want to customize the look and feel of your admin's index page. See `Tutorial 2`_ for more information. @@ -75,10 +75,10 @@ customizations. In particular, you'll need to do this: ``inspectdb`` only works with PostgreSQL and MySQL. Foreign-key detection only works in PostgreSQL. -install [app app ...] +install [modelmodule modelmodule ...] --------------------- -Executes the equivalent of ``sqlall`` for the given app(s). +Executes the equivalent of ``sqlall`` for the given model module(s). runserver [optional port number, or ipaddr:port] ------------------------------------------------ @@ -115,41 +115,41 @@ Port 7000 on IP address 1.2.3.4:: django-admin.py runserver 1.2.3.4:7000 -sql [app app ...] +sql [modelmodule modelmodule ...] ----------------- -Prints the CREATE TABLE SQL statements for the given app(s). +Prints the CREATE TABLE SQL statements for the given model module(s). -sqlall [app app ...] +sqlall [modelmodule modelmodule ...] -------------------- -Prints the CREATE TABLE and initial-data SQL statements for the given app(s). +Prints the CREATE TABLE and initial-data SQL statements for the given model module(s). -sqlclear [app app ...] +sqlclear [modelmodule modelmodule ...] ---------------------- -Prints the DROP TABLE SQL statements for the given app(s). +Prints the DROP TABLE SQL statements for the given model module(s). -sqlindexes [app app ...] +sqlindexes [modelmodule modelmodule ...] ------------------------ -Prints the CREATE INDEX SQL statements for the given app(s). +Prints the CREATE INDEX SQL statements for the given model module(s). -sqlinitialdata [app app ...] +sqlinitialdata [modelmodule modelmodule ...] ---------------------------- -Prints the initial INSERT SQL statements for the given app(s). +Prints the initial INSERT SQL statements for the given model module(s). -sqlreset [app app ...] +sqlreset [modelmodule modelmodule ...] ---------------------- -Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for the given app(s). +Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for the given model module(s). -sqlsequencereset [app app ...] +sqlsequencereset [modelmodule modelmodule ...] ------------------------------ Prints the SQL statements for resetting PostgreSQL sequences for the given -app(s). +model module(s). See http://simon.incutio.com/archive/2004/04/21/postgres for more information.