          except KeyError:
              pass
          self._populate()
          if app_mod:
              app_list = [self.app_models.get(app_mod.__name__.split('.')[-2], SortedDict())]
          else:
              app_list = self.app_models.itervalues()
          model_list = []
          for app in app_list:
              model_list.extend(
 
</s> remove             app_list = self.app_models.itervalues()
 </s> add             app_list = [self.app_models.get(app_label, SortedDict())
                        for app_label in self.app_labels.iterkeys()] </s> remove                 if ((not model._deferred or include_deferred)
                    and (not model._meta.auto_created or include_auto_created))
 </s> add                 if ((not model._deferred or include_deferred) and
                    (not model._meta.auto_created or include_auto_created)) </s> remove     model = get_model(app_label, model_name, False)
 </s> add     model = get_model(app_label, model_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): </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)
            if app_mod in self.app_store:
                app_list = [self.app_models.get(self._label_for(app_mod),
                                                SortedDict())]
            else:
                app_list = []
          except KeyError:
              pass
          self._populate()
          if app_mod:
            if app_mod in self.app_store:
                app_list = [self.app_models.get(self._label_for(app_mod),
                                                SortedDict())]
            else:
                app_list = []
          else:
              app_list = self.app_models.itervalues()
          model_list = []
          for app in app_list:
              model_list.extend(
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/loading.py