gpt4 book ai didi

ProgrammingError: more than one row returned by a subquery used as an expression(ProgrammingError:用作表达式的子查询返回多行)

转载 作者:bug小助手 更新时间:2023-10-25 12:31:43 32 4
gpt4 key购买 nike



I have this function

我有这个功能


def with_items_photos(self):
photos_subquery = Photo.objects.filter(
object_id=OuterRef('pk'),
content_type=ContentType.objects.get_for_model(DeliveryItem)
).values('pk')

return self.annotate(
photos=Subquery(
photos_subquery.annotate(
photo_ids=ArrayAgg('pk')
).values('photo_ids')
)
)

I would like to get array of photo_ids for each item but get an error

我想要获取每个项目的照片ID数组,但得到一个错误


更多回答
优秀答案推荐
更多回答

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com