Fixed #25658 -- Allowed inspectdb to inspect a specific set of tables.

This commit is contained in:
José Tomás Tocino 2015-11-02 00:53:43 +01:00 committed by Tim Graham
parent f15f4b8bb6
commit 39a16dd2e0
5 changed files with 28 additions and 3 deletions

View file

@ -354,11 +354,12 @@ Specifies the database to flush. Defaults to ``default``.
``inspectdb``
-------------
.. django-admin:: inspectdb
.. django-admin:: inspectdb [table [table ...]]
Introspects the database tables in the database pointed-to by the
:setting:`NAME` setting and outputs a Django model module (a ``models.py``
file) to standard output.
file) to standard output. You may choose what tables to inspect by passing
their names as arguments.
Use this if you have a legacy database with which you'd like to use Django.
The script will inspect the database and create a model for each table within
@ -406,6 +407,11 @@ table's lifecycle, you'll need to change the
:attr:`~django.db.models.Options.managed` option to ``True`` (or simply remove
it because ``True`` is its default value).
.. versionadded:: 1.10
Support for the ``table`` argument(s) to choose what tables should be
inspected was added.
.. django-admin-option:: --database DATABASE
Specifies the database to introspect. Defaults to ``default``.