Ticket #12291: loading.py.diff

File loading.py.diff, 1.1 KB (added by phuihock, 6 years ago)
  • django/db/models/loading.py

     
    3030
    3131        # -- Everything below here is only used when populating the cache --
    3232        loaded = False,
    33         handled = {},
     33        handled = [],
    3434        postponed = [],
    3535        nesting_level = 0,
    3636        write_lock = threading.RLock(),
     
    6767        Loads the app with the provided fully qualified name, and returns the
    6868        model module.
    6969        """
    70         self.handled[app_name] = None
     70        if not app_name in self.handled:
     71            self.handled.append(app_name)
    7172        self.nesting_level += 1
    7273        mod = __import__(app_name, {}, {}, ['models'])
    7374        self.nesting_level -= 1
     
    8081                self.postponed.append(app_name)
    8182            return None
    8283        if mod.models not in self.app_store:
    83             self.app_store[mod.models] = len(self.app_store)
     84            self.app_store[mod.models] = self.handled.index(app_name)
    8485        return mod.models
    8586
    8687    def app_cache_ready(self):
Back to Top