如果您查看 Django 中聚合函数的定义,您会发现它们实际上是类的子类,django.db.models.aggregates.Aggregate
它们的构造函数如下所示:
class Aggregate(object):
"""
Default Aggregate definition.
"""
def __init__(self, lookup, **extra):
"""Instantiate a new aggregate.
* lookup is the field on which the aggregate operates.
* extra is a dictionary of additional data to provide for the
aggregate definition
Also utilizes the class variables:
* name, the identifier for this aggregate function.
"""
self.lookup = lookup
self.extra = extra
#... the rest is truncated
这个额外的关键字参数用于什么?我可以使用它们对聚合进行更复杂的查询吗?我试图在上面找到任何文档,但没有成功。我相信它没有记录在案,但无论如何,这些额外的论点是什么,可以用它们做什么?
谢谢。