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.
评论列表
文章目录