          if not isinstance(copy.output_field, (DateField, DateTimeField, TimeField)):
              raise ValueError('output_field must be either DateField, TimeField, or DateTimeField')
          # Passing dates or times to functions expecting datetimes is most
          # likely a mistake.
          output_field = copy.output_field
          explicit_output_field = field.__class__ != copy.output_field.__class__
          if type(field) == DateField and (
                  isinstance(output_field, DateTimeField) or copy.kind in ('hour', 'minute', 'second', 'time')):
              raise ValueError("Cannot truncate DateField '%s' to %s. " % (
                  field.name, output_field.__class__.__name__ if explicit_output_field else 'DateTimeField'
              ))
 
</s> remove                 field.name, output_field.__class__.__name__ if explicit_output_field else 'DateTimeField'
 </s> add                 field.name, output_field.__class__.__name__ if has_explicit_output_field else 'DateTimeField' </s> remove                 field.name, output_field.__class__.__name__ if explicit_output_field else 'DateTimeField'
 </s> add                 field.name, output_field.__class__.__name__ if has_explicit_output_field else 'DateTimeField' </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     DateField, DateTimeField, DurationField, IntegerField, TimeField,
 </s> add     DateField, DateTimeField, DurationField, Field, IntegerField, TimeField,
        class_output_field = self.__class__.output_field if isinstance(self.__class__.output_field, Field) else None
        output_field = class_output_field or copy.output_field
        has_explicit_output_field = class_output_field or field.__class__ is not copy.output_field.__class__
          if not isinstance(copy.output_field, (DateField, DateTimeField, TimeField)):
              raise ValueError('output_field must be either DateField, TimeField, or DateTimeField')
          # Passing dates or times to functions expecting datetimes is most
          # likely a mistake.
        class_output_field = self.__class__.output_field if isinstance(self.__class__.output_field, Field) else None
        output_field = class_output_field or copy.output_field
        has_explicit_output_field = class_output_field or field.__class__ is not copy.output_field.__class__
        class_output_field = self.__class__.output_field if isinstance(self.__class__.output_field, Field) else None
        output_field = class_output_field or copy.output_field
        has_explicit_output_field = class_output_field or field.__class__ is not copy.output_field.__class__
          if type(field) == DateField and (
                  isinstance(output_field, DateTimeField) or copy.kind in ('hour', 'minute', 'second', 'time')):
              raise ValueError("Cannot truncate DateField '%s' to %s. " % (
                  field.name, output_field.__class__.__name__ if explicit_output_field else 'DateTimeField'
              ))
keep keep keep keep 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/functions/datetime.py