Avoid an O(n**2) operation where O(n) will suffice. Possibly worth a second or two when running the test suite.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14433 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Alex Gaynor 2010-11-02 05:41:46 +00:00
parent 89219a6829
commit ed51dd5d64
1 changed files with 4 additions and 2 deletions

View File

@ -631,8 +631,10 @@ class BaseDatabaseIntrospection(object):
for model in models.get_models(app):
if router.allow_syncdb(self.connection.alias, model):
all_models.append(model)
return set([m for m in all_models
if self.table_name_converter(m._meta.db_table) in map(self.table_name_converter, tables)
tables = map(self.table_name_converter, tables)
return set([
m for m in all_models
if self.table_name_converter(m._meta.db_table) in tables
])
def sequence_list(self):