If I have:
class Example(serializers.ModelSerializer):
time = DateTimeRangeField(required=False)
it will fail with an error:
{'time': ['This field is required.']}
However if this was serializers.Serializer it respects the required attribute on the field. Has anybody else come across this? Any ideas on how to make a field not required?
DateTimeRangeField
不是 Django REST框架字段,因此就像您根本没有提供任何字段一样。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.