  
      def __invert__(self):
          return type(self)(self.queryset, negated=(not self.negated), **self.extra)
  
      @property
      def output_field(self):
          return fields.BooleanField()
  
      def resolve_expression(self, query=None, **kwargs):
          # As a performance optimization, remove ordering since EXISTS doesn't
          # care about it, just whether or not a row matches.
          self.queryset = self.queryset.order_by()
          return super().resolve_expression(query, **kwargs)
 
</s> remove 
    def __init__(self, string, substring, **extra):
        """
        string: the name of a field, or an expression returning a string
        substring: the name of a field, or an expression returning a string
        """
        super().__init__(string, substring, output_field=fields.IntegerField(), **extra)
 </s> add     output_field = fields.IntegerField() </s> remove     def __init__(self, y, x, output_field=FloatField(), filter=None):
 </s> add     output_field = FloatField()

    def __init__(self, y, x, output_field=None, filter=None): </s> remove     @cached_property
    def output_field(self):
        return IntegerField()

 </s> add  </s> remove 
    def __init__(self, *args, output_field=None, **kwargs):
        super().__init__(*args, output_field=TimeField(), **kwargs)
 </s> add     output_field = TimeField()
  
      def __invert__(self):
          return type(self)(self.queryset, negated=(not self.negated), **self.extra)
  




      def resolve_expression(self, query=None, **kwargs):
          # As a performance optimization, remove ordering since EXISTS doesn't
          # care about it, just whether or not a row matches.
          self.queryset = self.queryset.order_by()
          return super().resolve_expression(query, **kwargs)
keep keep keep keep replace replace replace replace keep keep keep keep keep
 Fixed #28492 -- Defined default output_field of expressions at the class level.

This wasn't possible when settings were accessed during Field initialization
time as our test suite setup script was triggering imports of expressions
before settings were configured. 
django/db/models/expressions.py