summaryrefslogtreecommitdiff
path: root/django/contrib/postgres/aggregates/general.py
diff options
context:
space:
mode:
authororf <tom@tomforb.es>2017-01-23 15:34:42 +0000
committerTim Graham <timograham@gmail.com>2017-02-04 13:57:39 -0500
commitb5393028bfc939adf14d0fa5e4088cddd3b9dfa1 (patch)
tree4168b42b77be5bce7d3b8d0acf2819098344412c /django/contrib/postgres/aggregates/general.py
parent245f20910906c8f17e1011a00f7042e1d8f39c76 (diff)
downloaddjango-b5393028bfc939adf14d0fa5e4088cddd3b9dfa1.tar.gz
Fixed #27767 -- Added distinct argument to ArrayAgg.
Diffstat (limited to 'django/contrib/postgres/aggregates/general.py')
-rw-r--r--django/contrib/postgres/aggregates/general.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/django/contrib/postgres/aggregates/general.py b/django/contrib/postgres/aggregates/general.py
index ac18a516d6..91835a9ca3 100644
--- a/django/contrib/postgres/aggregates/general.py
+++ b/django/contrib/postgres/aggregates/general.py
@@ -8,6 +8,10 @@ __all__ = [
class ArrayAgg(Aggregate):
function = 'ARRAY_AGG'
+ template = '%(function)s(%(distinct)s%(expressions)s)'
+
+ def __init__(self, expression, distinct=False, **extra):
+ super().__init__(expression, distinct='DISTINCT ' if distinct else '', **extra)
def convert_value(self, value, expression, connection, context):
if not value: