如果我有一些ModelAdmin定义了一个自定义查询集,例如:
def get_queryset(self, request):
queryset = super().get_queryset(request)
queryset = queryset.annotate(
other_amount=Sum('other__amount'),
delta = Sum(-1*F('amount') - F('other__amount')),
)
return queryset
当我创建类似以下的管理操作时:
def makeReimbursableUnsubmitted(modeladmin, request, queryset):
queryset.update(updated_status='RU')
然后运行操作,出现以下错误:
Cannot resolve keyword 'delta' into field. Choices are: <fields defined in the model>
如何更新我的操作以重新工作?