第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

我寫的response_model_include和response_model_exclude沒(méi)有效果

@app04.post(
????"/response_model/attributes",
????#response_model=UserOut,
????#response_model=Union[UserIn,?UserOut]#取并集
????#response_model=List[UserOut]?#也可以用列表,響應(yīng)多個(gè)模型類return?[user,user]
????response_model_include=["username",?"email"]?#當(dāng)響應(yīng)字段太多時(shí)指定包含或排除哪些字段
????#?response_model_exclude={"mobile"}

)
async?def?response_model_attributes(user:?UserIn):
????#del?user.password?#Union[UserIn,?UserOut]后,刪除password屬性
????return?user

我試了好幾次,,返回都是返回了全部字段;

http://img1.sycdn.imooc.com/619cbe2e0001712e06700467.jpg

正在回答

2 回答

把[],改成{}:

response_model_include={'username','mobile'},

還有。model不能少,不然也不行:

esponse_model=UserOut,


1 回復(fù) 有任何疑惑可以回復(fù)我~
response_model_exclude_unset=True


0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

我寫的response_model_include和response_model_exclude沒(méi)有效果

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)