当我的以下过程完成时,我想要一种方法来更新模型字段中的状态。
视图.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,这是正确的方法吗?