serialize.py 文件源码

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

项目:django-mongo-rest 作者: TrueSkills 项目源码 文件源码
def _document_typeof(doc_cls, field_name):
    try:
        orm_field = doc_cls._fields[field_name]
    except (KeyError, AttributeError):
        return None

    if isinstance(orm_field, ListField):
        orm_field = orm_field.field
    if isinstance(orm_field, (ReferenceField, EmbeddedDocumentField)):
        return orm_field.document_type

    return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号