  class StringAgg(OrderableAggMixin, Aggregate):
      function = 'STRING_AGG'
      template = "%(function)s(%(distinct)s%(expressions)s, '%(delimiter)s'%(ordering)s)"
  
      def __init__(self, expression, delimiter, distinct=False, **extra):
          distinct = 'DISTINCT ' if distinct else ''
          super().__init__(expression, delimiter=delimiter, distinct=distinct, **extra)
  
      def convert_value(self, value, expression, connection):
          if not value:
              return ''
          return value
 
</s> remove     def __init__(self, expression, distinct=False, **extra):
        super().__init__(expression, distinct='DISTINCT ' if distinct else '', **extra)

 </s> add  </s> remove         super().__init__(
            expression, distinct='DISTINCT ' if distinct else '',
            filter=filter, **extra
        )

    def _get_repr_options(self):
        return {**super()._get_repr_options(), 'distinct': self.extra['distinct'] != ''}
 </s> add         super().__init__(expression, filter=filter, **extra) </s> remove     template = '%(function)s(%(distinct)s%(expressions)s)'
 </s> add 
    def __init__(self, expression, delimiter, **extra):
        super().__init__(expression, delimiter=delimiter, **extra)
  class StringAgg(OrderableAggMixin, Aggregate):
      function = 'STRING_AGG'
      template = "%(function)s(%(distinct)s%(expressions)s, '%(delimiter)s'%(ordering)s)"
  
    def __init__(self, expression, delimiter, **extra):
        super().__init__(expression, delimiter=delimiter, **extra)
    def __init__(self, expression, delimiter, **extra):
        super().__init__(expression, delimiter=delimiter, **extra)
    def __init__(self, expression, delimiter, **extra):
        super().__init__(expression, delimiter=delimiter, **extra)
  
      def convert_value(self, value, expression, connection):
          if not value:
              return ''
          return value
keep keep keep keep replace replace replace keep keep keep keep keep
 Fixed #28658 -- Added DISTINCT handling to the Aggregate class. 
django/contrib/postgres/aggregates/general.py