Debian Codegraph @

django/contrib/postgres/expressions.py

raw
1 from django.contrib.postgres.fields import ArrayField
2 from django.db.models import Subquery
3 from django.utils.functional import cached_property
4
5
6 class ArraySubquery(Subquery):
7 template = "ARRAY(%(subquery)s)"
8
9 def __init__(self, queryset, **kwargs):
10 super().__init__(queryset, **kwargs)
11
12 @cached_property
13 def output_field(self):
14 return ArrayField(self.query.output_field)