serializers.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:django-elasticsearch-dsl-drf 作者: barseghyanartur 项目源码 文件源码
def __init__(self, instance=None, data=empty, **kwargs):
        super(DocumentSerializer, self).__init__(instance, data, **kwargs)

        if not hasattr(self.Meta, 'document') or self.Meta.document is None:
            raise ImproperlyConfigured(
                "You must set the 'document' attribute on the serializer "
                "Meta class."
            )

        if not issubclass(self.Meta.document, (DocType,)):
            raise ImproperlyConfigured(
                "You must subclass the serializer 'document' from the DocType"
                "class."
            )

        if not self.instance:
            self.instance = EmptySearch()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号