some fileds satisfied the fellowing condition: isinstance(self.drf_field, DateField) is True but actual the type of the fields is datetime.date, so it return null accding the coding . i think it is a problem, it set null for existing value.
so i add a return as below and solve the problem. pls check it
try:
if (
isinstance(self.drf_field, DateTimeField)
and type(value) != datetime.datetime
):
return self._parse_date(
value, "DATETIME_FORMAT", parse_datetime
).replace(tzinfo=None)
elif isinstance(self.drf_field, DateField) and type(value) != datetime.date:
return self._parse_date(value, "DATE_FORMAT", parse_date)
elif isinstance(self.drf_field, TimeField) and type(value) != datetime.time:
return self._parse_date(value, "TIME_FORMAT", parse_time).replace(
tzinfo=None
)
return value # add this code!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
some fileds satisfied the fellowing condition: isinstance(self.drf_field, DateField) is True but actual the type of the fields is datetime.date, so it return null accding the coding . i think it is a problem, it set null for existing value.
so i add a return as below and solve the problem. pls check it