Django rest framework 的实践笔记(三)

释放双眼,带上耳机,听听看~!

继承serializers.ModelSerializer也报和HyperLinkedModelSerialize一样的错误

django.core.exceptions.ImproperlyConfigured: Could not resolve URL for hyperlinked relationship using view name "user-detail". You may
have failed to include the related model in your API, or incorrectly configured the `lookup_field` attribute on this field.

改为ListSerializer后

class UserSerializer(serializers.ListSerializer):
    class Meta:
        model = User
        fields = ('url', 'username', 'email', 'is_staff')
AssertionError: `child` is a required argument.

使用serializers.Serializer成功
Django rest framework 的实践笔记(三)
但是为什么什么也没取到,是个空
添加retrieve方法仍然是空

【转自慕课】https://www.imooc.com

Python

python 字符集基础知识

2022-3-3 0:51:25

Python

Python入门到实践-Hello Python3

2022-3-3 0:52:03

搜索