models.py 文件源码

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

项目:Wagtail-Document-Folders 作者: anteatersa 项目源码 文件源码
def get_document_model():
    from django.conf import settings
    from django.apps import apps

    try:
        app_label, model_name = settings.WAGTAILDOCS_DOCUMENT_MODEL.split('.')
    except AttributeError:
        return Document
    except ValueError:
        raise ImproperlyConfigured("WAGTAILDOCS_DOCUMENT_MODEL must be of the form 'app_label.model_name'")

    document_model = apps.get_model(app_label, model_name)
    if document_model is None:
        raise ImproperlyConfigured(
            "WAGTAILDOCS_DOCUMENT_MODEL refers to model '%s' that has not been installed" %
            settings.WAGTAILDOCS_DOCUMENT_MODEL
        )
    return document_model


# Receive the pre_delete signal and delete the file associated with the model instance.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号