Django

update_or_create

2019-02-12  本文已影响503人  butters001
SystemConfig.objects.update_or_create(host_ip=host_ip, type=TYPE, defaults={'config': config})
# 相当于先去 get(host_ip=host_ip, type=TYPE) 如果存在更新 config
# 不存在 create(host_ip=host_ip, type=TYPE, config=config)
上一篇 下一篇

猜你喜欢

热点阅读