  class CharPrimaryKeyModel(models.Model):
      id = models.CharField(max_length=20, primary_key=True)
  
  
  class DateObject(object):
      def __init__(self, date):
          self.date = date
  
  
  class DateTimeObject(object):
      def __init__(self, date_time):
          self.date_time = date_time
  
  
  class TimeObject(object):
      def __init__(self, time):
          self.time = time
  
  
  class TimestampedModelSerializer(serializers.ModelSerializer):
      class Meta:
          model = TimestampedModel
  
  
 
</s> remove class DateObjectSerializer(serializers.Serializer):
    date = serializers.DateField()

    def restore_object(self, attrs, instance=None):
        if instance is not None:
            instance.date = attrs['date']
            return instance
        return DateObject(**attrs)


class DateObjectCustomFormatSerializer(serializers.Serializer):
    date = serializers.DateField(format=("%Y", "%Y -- %m"))

    def restore_object(self, attrs, instance=None):
        if instance is not None:
            instance.date = attrs['date']
            return instance
        return DateObject(**attrs)


class DateTimeObjectSerializer(serializers.Serializer):
    date_time = serializers.DateTimeField()

    def restore_object(self, attrs, instance=None):
        if instance is not None:
            instance.date_time = attrs['date_time']
            return instance
        return DateTimeObject(**attrs)


class DateTimeObjectCustomFormatSerializer(serializers.Serializer):
    date_time = serializers.DateTimeField(format=("%Y", "%Y %H:%M"))

    def restore_object(self, attrs, instance=None):
        if instance is not None:
            instance.date_time = attrs['date_time']
            return instance
        return DateTimeObject(**attrs)


class TimeObjectSerializer(serializers.Serializer):
    time = serializers.TimeField()

    def restore_object(self, attrs, instance=None):
        if instance is not None:
            instance.time = attrs['time']
            return instance
        return TimeObject(**attrs)


class TimeObjectCustomFormatSerializer(serializers.Serializer):
    time = serializers.TimeField(format=("%H -- %M", "%H%M%S"))

    def restore_object(self, attrs, instance=None):
        if instance is not None:
            instance.time = attrs['time']
            return instance
        return TimeObject(**attrs)


 </s> add  </s> remove         self.format = kwargs.pop('format', settings.TIME_INPUT_FORMATS)
 </s> add         self.input_formats = kwargs.pop('input_formats', api_settings.TIME_INPUT_FORMATS)
        self.output_format = kwargs.pop('output_format', api_settings.TIME_OUTPUT_FORMAT) </s> remove         self.format = kwargs.pop('format', settings.DATE_INPUT_FORMATS)
 </s> add         self.input_formats = kwargs.pop('input_formats', api_settings.DATE_INPUT_FORMATS)
        self.output_format = kwargs.pop('output_format', api_settings.DATE_OUTPUT_FORMAT) </s> remove         self.format = kwargs.pop('format', settings.DATETIME_INPUT_FORMATS)
 </s> add         self.input_formats = kwargs.pop('input_formats', api_settings.DATETIME_INPUT_FORMATS)
        self.output_format = kwargs.pop('output_format', api_settings.DATETIME_OUTPUT_FORMAT)
  class CharPrimaryKeyModel(models.Model):
      id = models.CharField(max_length=20, primary_key=True)
  
  















  class TimestampedModelSerializer(serializers.ModelSerializer):
      class Meta:
          model = TimestampedModel
  
  
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 Add drf settings + output format + testcases 
rest_framework/tests/fields.py