      # Handle references to tables that are from other apps
      # but don't exist physically
      not_installed_models = set(pending_references.keys())
      if not_installed_models:
          final_output.append('-- The following references should be added but depend on non-existant tables:')
          for model in not_installed_models:
              final_output.extend(['-- ' + sql for sql in
                  _get_sql_for_pending_references(model, pending_references)])
  
      return final_output
 
</s> remove             final_output.extend(['-- ' + sql for sql in
 </s> add             alter_sql.extend(['-- ' + sql for sql in </s> remove     app_models = models.get_models(app)
 </s> add  </s> remove     known_models = set(_get_installed_models(_get_table_list()))
 </s> add     known_models = set([model for model in _get_installed_models(_get_table_list()) if model not in app_models]) </s> remove     # Get installed models, so we generate REFERENCES right
 </s> add     # Get installed models, so we generate REFERENCES right.
    # We trim models from the current app so that the sqlreset command does not
    # generate invalid SQL (leaving models out of known_models is harmless, so
    # we can be conservative).
    app_models = models.get_models(app)
        alter_sql = []
      # Handle references to tables that are from other apps
      # but don't exist physically
      not_installed_models = set(pending_references.keys())
      if not_installed_models:
        alter_sql = []
          for model in not_installed_models:
              final_output.extend(['-- ' + sql for sql in
                  _get_sql_for_pending_references(model, pending_references)])
  
      return final_output
keep keep keep keep replace keep keep keep keep keep
 Fixed #2260 -- fixed a problem where some foreign key references were being
omitted during a "reset" or "sqlreset". Thanks, marcink@elksoft.pl.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3542 bcc190cf-cafb-0310-a4f2-bffc1f526a37 
django/core/management.py