model.py
class Form(models.Model):
no = models.IntegerField()
finish_date = models.DateField(blank=True, null=True)
serializers.py
class FormSerializer(serializers.ModelSerializer):
class Meta:
model = Form
fields = '__all__'
if I try:
http http://127.0.0.1:8000/api/forms no=112 "finish_date"=""
It returns the error:
"finish_date": [
"Date has wrong format. Use one of these formats instead: YYYY[-MM[-DD]]."
]
If I set "finish_date" to null , this post works.
And StringField(blank=True, null=True) will not get the error.
How to solve?