Skip to content

Commit

Permalink
Fixed #454 -- Clarified django-admin '--help' output to use 'modelmod…
Browse files Browse the repository at this point in the history
…ule' instead of 'app'. Thanks, Maniac

git-svn-id: http://code.djangoproject.com/svn/django/trunk@607 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
adrianholovaty committed Sep 2, 2005
1 parent fe66d3b commit 59b2045
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
24 changes: 12 additions & 12 deletions django/core/management.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</tr>
{%% 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.
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand All @@ -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):
Expand All @@ -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):
Expand All @@ -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):
Expand Down Expand Up @@ -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):
Expand All @@ -281,7 +281,7 @@ def get_admin_index(mod):
output.append('</table></div>')
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():
Expand Down Expand Up @@ -321,7 +321,7 @@ def install(mod):
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=''):
Expand Down Expand Up @@ -376,7 +376,7 @@ def startproject(project_name, directory):
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, '../'))
Expand Down
44 changes: 22 additions & 22 deletions docs/django-admin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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]
------------------------------------------------
Expand Down Expand Up @@ -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.

Expand Down

0 comments on commit 59b2045

Please sign in to comment.