  
      def _get_repr_options(self):
          options = super()._get_repr_options()
          if self.filter:
              options.update({'filter': self.filter})
          return options
  
  
  class Avg(Aggregate):
      function = 'AVG'
 
</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 
            options['filter'] = self.filter
  
      def _get_repr_options(self):
          options = super()._get_repr_options()
          if self.filter:
            options['filter'] = self.filter
          return options
  
  
  class Avg(Aggregate):
      function = 'AVG'
keep keep keep keep replace keep keep keep keep keep
 Fixed #28658 -- Added DISTINCT handling to the Aggregate class. 
django/db/models/aggregates.py