Py学习  »  问与答

django models update问题。

a4012017 • 10 年前 • 3391 次点击  

请问如何实现 类似于sql update table where name = name + 100 where id = 1 这样的操作。 p.objects.filter(id=1).update()

基本格式是这样么,如果是的话 那update中内容怎么写。 我尝试 update(name = name + 100) 或者 update(name += name + 100) 都是不行的。。 求各位大神指教!~

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/816
 
3391 次点击  
文章 [ 1 ]  |  最新文章 10 年前