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:
parent
db70944e65
commit
c36159c6d9
@ -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."
|
||||
|
Loading…
x
Reference in New Issue
Block a user