We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DateTimeField
django 2.2.* rest_framework 3.9.1 multipart/form-data POST (have files upload) DateTimeField "required": false,
from rest_framework import fields def rewrite(cls, func='to_internal_value'): # 重写函数,使提交保存的日期时间字段为""时,不报格式错误 old_func = getattr(cls, func) def new_func(self, value): # import ipdb; ipdb.set_trace() if value == '': # return self.get_default() # 旧数据原值不变或新数据取默认值 return None # 表字段数据设置为null return old_func(self, value) setattr(cls, func, new_func) # print(cls, '已重写函数', func) rewrite(fields.DateTimeField) rewrite(fields.DateField) rewrite(fields.TimeField)
#3726
The text was updated successfully, but these errors were encountered:
No branches or pull requests
django 2.2.*
rest_framework 3.9.1
multipart/form-data POST (have files upload)
DateTimeField "required": false,
#3726
The text was updated successfully, but these errors were encountered: