      # Try to look up the related model, and if it's already loaded resolve the
      # string right away. If get_model returns None, it means that the related
      # model isn't loaded yet, so we need to pend the relation until the class
      # is prepared.
      model = get_model(app_label, model_name, False)
      if model:
          operation(field, model, cls)
      else:
          key = (app_label, model_name)
          value = (cls, field, operation)
 
</s> remove         return get_model(new_class._meta.app_label, name, False)
 </s> add         return get_model(new_class._meta.app_label, name,
                         seed_cache=False, only_installed=False) </s> remove         m = get_model(new_class._meta.app_label, name, False)
 </s> add         m = get_model(new_class._meta.app_label, name,
                      seed_cache=False, only_installed=False) </s> remove     def get_model(self, app_label, model_name, seed_cache=True):
 </s> add     def get_model(self, app_label, model_name,
                  seed_cache=True, only_installed=True):
    model = get_model(app_label, model_name,
                      seed_cache=False, only_installed=False)
      # Try to look up the related model, and if it's already loaded resolve the
      # string right away. If get_model returns None, it means that the related
      # model isn't loaded yet, so we need to pend the relation until the class
      # is prepared.
    model = get_model(app_label, model_name,
                      seed_cache=False, only_installed=False)
      if model:
          operation(field, model, cls)
      else:
          key = (app_label, model_name)
          value = (cls, field, operation)
keep keep keep keep replace keep keep keep keep keep
 Fixed #15866, #15850 -- Prevented get_model() and get_models() from returning not-installed models (by default). Thanks adsva for report.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16053 bcc190cf-cafb-0310-a4f2-bffc1f526a37 
django/db/models/fields/related.py