      window_compatible = True
  
      def __init__(self, *args, filter=None, **kwargs):
          self.filter = filter
          super().__init__(*args, **kwargs)
  
      def get_source_fields(self):
          # Don't return the filter expression since it's not a source field.
          return [e._output_field_or_none for e in super().get_source_expressions()]
  
 
</s> remove     def __init__(self, *args, filter=None, **kwargs):
 </s> add     def __init__(self, *expressions, distinct=False, filter=None, **extra):
        if distinct and not self.allow_distinct:
            raise TypeError("%s does not allow distinct." % self.__class__.__name__)
        self.distinct = distinct </s> remove     def __init__(self, expression, distinct=False, filter=None, **extra):
 </s> add     def __init__(self, expression, filter=None, **extra): </s> remove     template = '%(function)s(%(distinct)s%(expressions)s)'
 </s> add 
        super().__init__(*expressions, **extra)
      window_compatible = True
  
      def __init__(self, *args, filter=None, **kwargs):
          self.filter = filter
        super().__init__(*expressions, **extra)
  
      def get_source_fields(self):
          # Don't return the filter expression since it's not a source field.
          return [e._output_field_or_none for e in super().get_source_expressions()]
  
keep keep keep keep replace keep keep keep keep keep
 Fixed #28658 -- Added DISTINCT handling to the Aggregate class. 
django/db/models/aggregates.py