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()
serializers.py 文件源码
python
阅读 21
收藏 0
点赞 0
评论 0
评论列表
文章目录