def updateTheme(self, id, new_theme):
theme = Theme.query.filter_by(id = id).first()
theme.update(new_theme)
db.session.commit()
错误:“主题”对象没有属性“更新”
这应该是这样的:
theme = Theme(name = "osman")
new_theme = Theme(name = "miras")
theme.update(new_theme)
print(theme) # osman have to be changed to miras
即使我可以做到:
theme.name = "miras"
当我必须使用多个参数时,例如姓名,姓氏,电话。而且updateTheme并不总是提供所有参数(名称,姓氏,电话),并且它应该仅更新提供的参数。例如:
person = {name: "john", surname: "smith", phone: 12345, country: "USA"}
update_person = {country: "Portugal"}
person.update(update_person) # should change only country
答案 0 :(得分:0)
如果要更新一个或两个字段,可以使用:
cordova plugin add cordova-plugin-inappbrowser
如果您想更新更多字段:
<feature name="InAppBrowser">
<param name="android-package" value="org.apache.cordova.InAppBrowser" />
</feature>