  class ArrayAgg(OrderableAggMixin, Aggregate):
      function = 'ARRAY_AGG'
      template = '%(function)s(%(distinct)s%(expressions)s %(ordering)s)'
  
      @property
      def output_field(self):
          return ArrayField(self.source_expressions[0].output_field)
  
 
</s> remove     def __init__(self, expression, distinct=False, **extra):
        super().__init__(expression, distinct='DISTINCT ' if distinct else '', **extra)

 </s> add  </s> remove     def __init__(self, expression, delimiter, distinct=False, **extra):
        distinct = 'DISTINCT ' if distinct else ''
        super().__init__(expression, delimiter=delimiter, distinct=distinct, **extra)
 </s> add     def __init__(self, expression, delimiter, **extra):
        super().__init__(expression, delimiter=delimiter, **extra) </s> remove     template = '%(function)s(%(distinct)s%(expressions)s)'
 </s> add  </s> remove             options.update({'filter': self.filter})
 </s> add             options['filter'] = self.filter
    allow_distinct = True
  class ArrayAgg(OrderableAggMixin, Aggregate):
      function = 'ARRAY_AGG'
      template = '%(function)s(%(distinct)s%(expressions)s %(ordering)s)'
    allow_distinct = True
  
      @property
      def output_field(self):
          return ArrayField(self.source_expressions[0].output_field)
  
keep keep add keep keep keep keep keep
 Fixed #28658 -- Added DISTINCT handling to the Aggregate class. 
django/contrib/postgres/aggregates/general.py