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