summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorJosé Tomás Tocino <theom3ga@gmail.com>2015-11-02 00:53:43 +0100
committerTim Graham <timograham@gmail.com>2016-03-18 08:41:15 -0400
commit39a16dd2e003f9ca82a6d061a022ced6904bd243 (patch)
tree095501cde20167ec569edad04b8b5e0741ebab5f /django
parentf15f4b8bb6f45dfdcb74f71e8dcc30c0aaa6ac80 (diff)
Fixed #25658 -- Allowed inspectdb to inspect a specific set of tables.
Diffstat (limited to 'django')
-rw-r--r--django/core/management/commands/inspectdb.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/django/core/management/commands/inspectdb.py b/django/core/management/commands/inspectdb.py
index 982ba7f1bd..24310ee390 100644
--- a/django/core/management/commands/inspectdb.py
+++ b/django/core/management/commands/inspectdb.py
@@ -17,6 +17,8 @@ class Command(BaseCommand):
db_module = 'django.db'
def add_arguments(self, parser):
+ parser.add_argument('table', action='store', nargs='*', type=str,
+ help='Selects what tables or views should be introspected.')
parser.add_argument('--database', action='store', dest='database',
default=DEFAULT_DB_ALIAS, help='Nominates a database to '
'introspect. Defaults to using the "default" database.')
@@ -54,7 +56,9 @@ class Command(BaseCommand):
yield ''
yield 'from %s import models' % self.db_module
known_models = []
- for table_name in connection.introspection.table_names(cursor):
+ tables_to_introspect = options['table'] or connection.introspection.table_names(cursor)
+
+ for table_name in tables_to_introspect:
if table_name_filter is not None and callable(table_name_filter):
if not table_name_filter(table_name):
continue