def convert(self, value):
        if value is None:
            return None

        if isinstance(value, six.string_types):
            try:
                year, month, day = value[:10].split('-')

                return datetime_safe.date(int(year), int(month), int(day))
            except __HOLE__:
                raise ApiFieldError("Date provided to '%s' field doesn't appear to be a valid date string: '%s'" % (self.instance_name, value))

        return value
dataset/ETHPy150Open django-tastypie/django-tastypie/tastypie/fields.py/DateField.convert