[英]How to delete peewee model object field
我在python中使用peewee orm。 我得到用戶數據
user = User.select().where(User.user_id==1).get()
用戶對象具有密碼字段。 我不想從api發送用戶密碼數據。 我正在嘗試del user.password
但是它拋出AttributeError: __delete__
錯誤。 是否有刪除peewee對象字段的簡便方法。 我不想這樣寫選擇條件:
User.select(User.user_id, User.email, User.full_name) ....
不幸的是,沒有,您不能刪除實例屬性。 不過,您始終可以將其設置為“ None
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.