Django Rest Framework does 'serializers.DictFi

2019-09-15 05:12发布

If I import serializers from below, and look for all the fields, I don't see DictField

>>> from rest_framework import serializers
>>> print("\n".join([foo for foo in dir(serializers) if "Field" in foo]))
BooleanField
BoundField
CharField
ChoiceField
DateField
DateTimeField
DecimalField
DjangoImageField
EmailField
Field
FieldDoesNotExist
FileField
FloatField
HiddenField
HyperlinkedIdentityField
HyperlinkedRelatedField
ImageField
IntegerField
ListField
ManyRelatedField
ModelField
MultipleChoiceField
NestedBoundField
NullBooleanField
PrimaryKeyRelatedField
ReadOnlyField
RegexField
RelatedField
SerializerMethodField
SkipField
SlugField
SlugRelatedField
StringRelatedField
TimeField
URLField

But it's in the docs here, just after ListField (which is in the above list). Has this gone in the latest version of DRF, or am I looking in the wrong place?

1条回答
何必那么认真
2楼-- · 2019-09-15 06:09

DictField was added in 3.0.4.

UPDATE!

查看更多
登录 后发表回答