美文网首页Django
update_or_create

update_or_create

作者: butters001 | 来源:发表于2019-02-12 15:33 被阅读503次
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)

相关文章

网友评论

    本文标题:update_or_create

    本文链接:https://www.haomeiwen.com/subject/erdkeqtx.html