1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Made table_names() output sorted.

Fixed #18218 -- previously Django's introspection table_names() and
get_table_list() methods did not sort the output consistently. This
resulted in random order of inspected models.

This commit also removed all external usages of get_table_list().
table_names() should be used instead.

Thanks to claudep for patch and report.
This commit is contained in:
Anssi Kääriäinen
2012-04-29 02:11:55 +03:00
parent c2055ee161
commit 527cce80dc
6 changed files with 22 additions and 8 deletions

View File

@@ -42,7 +42,7 @@ class Command(NoArgsCommand):
yield 'from %s import models' % self.db_module
yield ''
known_models = []
for table_name in connection.introspection.get_table_list(cursor):
for table_name in connection.introspection.table_names(cursor):
yield 'class %s(models.Model):' % table2model(table_name)
known_models.append(table2model(table_name))
try:

View File

@@ -63,7 +63,7 @@ def sql_delete(app, style, connection):
# Figure out which tables already exist
if cursor:
table_names = connection.introspection.get_table_list(cursor)
table_names = connection.introspection.table_names(cursor)
else:
table_names = []