Skip to main content
 首页 » 编程设计

python之如何在 Django 中定义临界区

2024年10月24日32del

有什么简单的方法来定义临界区吗? 当一个用户在更新一些数据库表时,我会强制让另一个用户不能更新同一个表。

请您参考如下方法:

django-concurrency is an optimistic lock 1 implementation for Django.

Tested with: 1.4.x, 1.5.x, 1.6.x, 1.7.x 1.8.x.

It prevents users from doing concurrent editing in Django both from UI and from a django command.

我没用过,但我想这可以解决你的问题。 django-concurrency