请问如何实现 类似于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) 都是不行的。。 求各位大神指教!~
可以 类似
topic = get_object_or_404(Topic, pk = topic_id) # 获取主题 topic.num +=1 topic.save()