(cls, app, user_dict)
return cls.objects.update_or_create(
            defaults=updates, app=app, openid=updates["openid"])[0]
根据oauth的结果更新
根据oauth的结果更新
根据oauth的结果更新
def upsert_by_oauth(cls, app, user_dict):
        """根据oauth的结果更新"""
        assert "openid" in user_dict, "openid not found"
        updates = {
            k: v for k, v in user_dict.items()
            if k in model_fields(cls)
        }
        updates["synced_at"] = tz.now()
        return cls.objects.update_or_create(
            defaults=updates, app=app, openid=updates["openid"])[0]
def upsert_by_oauth ( cls , app , user_dict ) : assert "openid" in user_dict , "openid not found" updates = { k : v for k , v in user_dict . items ( ) if k in model_fields ( cls ) } updates [ "synced_at" ] = tz . now ( ) return cls . objects . update_or_create ( defaults = updates , app = app , openid = updates [ "openid" ] ) [ 0 ]