expressions.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:django-include 作者: chrisseto 项目源码 文件源码
def build_aggregate(self, queryset, compiler):
        agg = super(ManyToOneConstructor, self).build_aggregate(queryset, compiler)

        # Any ordering needs to be plucked from the query set and added into the JSONAgg that we will be build
        # because SQL
        kwargs = {}
        if queryset.ordered:
            kwargs['order_by'] = next(zip(*queryset.query.get_compiler(connection=compiler.connection).get_order_by()))
        queryset.query.clear_ordering(True)

        # many_to_one is a bit of a misnomer, the field we have is the "one" side
        return JSONAgg(agg, **kwargs)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号