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

[multi-db] Fixed bug in execution of pending references in install.

git-svn-id: http://code.djangoproject.com/svn/django/branches/multiple-db-support@4137 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jason Pellerin 2006-11-29 19:45:22 +00:00
parent e4e6bf0712
commit c000f6a480
2 changed files with 4 additions and 2 deletions

View File

@ -423,8 +423,7 @@ def _install(app, commit=True, initial_data=True, pending_allowed=False,
manager = model._default_manager manager = model._default_manager
if model in models_installed: if model in models_installed:
for rel_class, f in pending[model]: for rel_class, f in pending[model]:
for statement in manager.get_pending(rel_class, f): manager.get_pending(rel_class, f).execute()
statement.execute()
pending.pop(model) pending.pop(model)
elif not pending_allowed: elif not pending_allowed:
raise Exception("%s is not installed, but it has pending " raise Exception("%s is not installed, but it has pending "

View File

@ -147,6 +147,9 @@ class Manager(object):
return pending return pending
def get_pending(self, rel_class, f): def get_pending(self, rel_class, f):
"""Get list pending statement relating my model to rel_class via
field f
"""
builder = self.db.get_creation_module().builder builder = self.db.get_creation_module().builder
return builder.get_ref_sql(self.model, rel_class, f) return builder.get_ref_sql(self.model, rel_class, f)