@classmethod
    def read_prefs(cls, mem_prefs):
        db_prefs = {
            '%s__%s' % (pref['app'], pref['name']): pref for pref in
            cls.objects.values().order_by('app', 'name')
        }

        new_prefs = []
        for app, prefs in mem_prefs.items():
            for pref_name, pref_proxy in prefs.items():
                if not pref_proxy.static:  # Do not add static options to DB.
                    key = '%s__%s' % (app, pref_name)
                    if key in db_prefs:
                        # Entry already exists in DB. Let's get pref value from there.
                        pref_proxy.db_value = db_prefs[key]['text']
                    else:
                        new_prefs.append(cls(app=app, name=pref_name, text=pref_proxy.default))

        if new_prefs:
            try:
                cls.objects.bulk_create(new_prefs)
            except IntegrityError:  # Don't bother with duplicates.
                pass
Select the given thread as the current debugged thread.
dataset/ETHPy150Open idlesign/django-siteprefs/siteprefs/models.py/Preference.read_prefs--crossover with--dataset/ETHPy150Open EiNSTeiN-/idapython/python/idc.py/SelectThread