def load_from_db(self):
        """Return a dictionary of preferences by section directly from DB"""
        a = {}
        db_prefs = {p.preference.identifier(): p for p in self.queryset}
        for preference in self.registry.preferences():
            try:
                db_pref = db_prefs[preference.identifier()]
            except __HOLE__:
                db_pref = self.create_db_pref(
                    section=preference.section.name, name=preference.name, value=preference.default)

            self.to_cache(db_pref)
            a[preference.identifier()] = self.from_cache(
                preference.section.name, preference.name)

        return a
dataset/ETHPy150Open EliotBerriot/django-dynamic-preferences/dynamic_preferences/managers.py/PreferencesManager.load_from_db