Django AttributeError:'经理'对象没有属性' select_for_update'

时间:2011-12-01 13:35:37

标签: python django django-models

我在Django中有一个简单的模型定义。我想使用django select_for_update方法选择一个Object来确保数据持久性,因为多个线程需要更新单行但不同的列。但它给出了以下错误:

Obj = my_model.objects.select_for_update().filter(pk=1)

AttributeError: 'Manager' object has no attribute 'select_for_update'

请帮我解决这个问题。感谢

1 个答案:

答案 0 :(得分:1)

查看文档: https://docs.djangoproject.com/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.select_for_update

所以,如果你必须将你的django版本升级到开发版本!