报错信息:
AssertionError: ("Creating a ModelSerializer without either the 'fields' attribute or the 'exclude' attribute has been deprecated since 3.3.0, and is now disa
llowed. Add an explicit fields = '__all__' to the UserSerializer serializer.",
百度翻译:
assertionerRor:(“从3.3.0开始,创建不带'fields'属性或'exclude'属性的ModelSerializer已被弃用,现在是不允许的。向userSerializer序列化程序中添加一个显式字段=“\u all”,
原因:序列化器中没有fields字段(仔细检查发现单词写错了,改为fields即可)
class UserSerializer(HyperlinkedModelSerializer):
class Meta:
model = User
fileds = ('url','username','email')