Django filter in Subquery raise 'Выражение содержит смешанные типы. Вы должны установить выходное_поле' ошибка
I am using django orm Subquery. But when I add a specific filter parameter, FieldError: Expression contains mixed types. You must set output_field error was raised.
Можно ли узнать, что это за ошибка и как ее исправить?
Below is the code where the error occurs, and the error occurs when is_active=True and eventcardad__isnull=False in lines 6 and 7 are added!
- and I'm using PostgreSQL RDBMS!
personalized_event_ads_qs = CustomerPersonalization.objects.filter(
customer__id__in=Customer.objects.filter(accept_marketing=True).filter(email='abc1@naver.com')
).annotate(
element_ids=Subquery(
Element.objects.fil
is_active=True,
eventcardad__isnull=False,
campaign__in=campaign_qs,
).filter(
majors__in=OuterRef('majors'),
).filter(
Q(cities__in=OuterRef('cities')) |
Q(districts__in=OuterRef('districts'))
).values(
'is_active'
).annotate(
element_ids=ArrayAgg('eventcardad', distinct=True)
).values(
'element_ids'
)
)
).values(
'element_ids'
).annotate(
customers=ArrayAgg('customer', distinct=True)
)