serializersDictField blank false
The blank attribute for the serializers.DictField does not exist. However, you can set the required attribute to True to ensure that the field is not left blank.
For example:
class MySerializer(serializers.Serializer):
my_dict_field = serializers.DictField(required=True)
In this example, if my_dict_field is not included in the incoming data, the serializer will raise a ValidationError with a message that the field is required.
原文地址: http://www.cveoy.top/t/topic/bqQU 著作权归作者所有。请勿转载和采集!