[英]Django AttributeError: 'Manager' object has no attribute 'select_for_update'
I have a simple model define in Django. 我在Django中定义了一个简单的模型。 I want to select an Object using django select_for_update
method to ensure data persistence as multiple threads needs to update single row but different columns. 我想使用django select_for_update
方法选择一个对象,以确保数据持久性,因为多个线程需要更新单行但不同的列。 But it is giving following error: 但是它给出了以下错误:
Obj = my_model.objects.select_for_update().filter(pk=1)
AttributeError: 'Manager' object has no attribute 'select_for_update'
Please help me in solving this issue. 请帮助我解决这个问题。 Thanks 谢谢
check it out the documentation : https://docs.djangoproject.com/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.select_for_update 查看文档: https : //docs.djangoproject.com/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.select_for_update
so if you`ll have to upgrade your django version to the development version! 因此,如果您必须将Django版本升级到开发版本!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.