1
0
mirror of https://github.com/django/django.git synced 2025-07-04 17:59:13 +00:00

[boulder-oracle-sprint] management._get_installed_models() now handles case-insensitive database backends

git-svn-id: http://code.djangoproject.com/svn/django/branches/boulder-oracle-sprint@3987 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss 2006-11-04 21:20:15 +00:00
parent db70944e65
commit c36159c6d9

View File

@ -56,12 +56,16 @@ def _is_valid_dir_name(s):
def _get_installed_models(table_list):
"Gets a set of all models that are installed, given a list of existing tables"
from django.db import models
from django.db import models, backend
all_models = []
for app in models.get_apps():
for model in models.get_models(app):
all_models.append(model)
return set([m for m in all_models if m._meta.db_table in table_list])
if backend.uses_case_insensitive_names:
converter = str.upper
else:
converter = lambda x: x
return set([m for m in all_models if converter(m._meta.db_table) in map(converter, table_list)])
def _get_table_list():
"Gets a list of all db tables that are physically installed."