fix a latent bug when field_type belongs to int, bool and list.

pull/11048/head
Huiser WANG 1 year ago committed by GitHub
parent bad8400e77
commit 78d8e410db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -62,6 +62,8 @@ def create_serializer_class(serializer_name, fields_info):
data['required'] = False
data = set_default_by_type(field_type, data, field_info)
data = set_default_if_need(data, i)
if field_type in ['int', 'bool', 'list'] and "allow_blank" in data.keys():
data.pop('allow_blank')
field_name = data.pop('name')
field_class = type_field_map.get(field_type, serializers.CharField)
serializer_fields[field_name] = field_class(**data)

Loading…
Cancel
Save