0
我想要一种方法来在我的流程完成时更新模型字段中的状态。Django从模型中更新状态
views.py
#If we had a POST then get the request post values.
if request.method == 'POST':
batches = Batch.objects.for_user_pending(request.user)
for batch in batches:
ProcessRequests.delay(batch)
所以我想在视图中做这样的事情的......
batch.complete_update()
我的问题是,在我的模型因为我不知道如何,只需要一点帮助。
这是我迄今所做的......
我创建
STATUSES = (
('Pending', 'Pending'),
('Complete', 'Complete'),
('Failed', 'Failed'),
('Cancelled', 'Cancelled'),
)
然后模型函数调用def complete_update(self):
,但我不知道如何使用更新它的领域状态,然后将其全部保存在模型中。
预先感谢您。
PS,这是正确的方式去呢?