diff --git a/wagtail/api/v2/endpoints.py b/wagtail/api/v2/endpoints.py index 04b6b74503..dacc62ed34 100644 --- a/wagtail/api/v2/endpoints.py +++ b/wagtail/api/v2/endpoints.py @@ -12,7 +12,7 @@ from rest_framework.response import Response from rest_framework.viewsets import GenericViewSet from wagtail.wagtailcore.models import Page -from wagtail.wagtaildocs.models import Document +from wagtail.wagtaildocs.models import get_document_model from wagtail.wagtailimages.models import get_image_model from .filters import ( @@ -282,4 +282,4 @@ class DocumentsAPIEndpoint(BaseAPIEndpoint): extra_meta_fields = ['tags', ] default_fields = ['title', 'tags'] name = 'documents' - model = Document + model = get_document_model() diff --git a/wagtail/api/v2/signal_handlers.py b/wagtail/api/v2/signal_handlers.py index c57bc44ea8..c8e6c04165 100644 --- a/wagtail/api/v2/signal_handlers.py +++ b/wagtail/api/v2/signal_handlers.py @@ -6,7 +6,7 @@ from django.db.models.signals import post_delete, post_save from wagtail.contrib.wagtailfrontendcache.utils import purge_url_from_cache from wagtail.wagtailcore.models import get_page_models from wagtail.wagtailcore.signals import page_published, page_unpublished -from wagtail.wagtaildocs.models import Document +from wagtail.wagtaildocs.models import get_document_model from wagtail.wagtailimages.models import get_image_model from .utils import get_base_url @@ -31,6 +31,7 @@ def purge_document_from_cache(instance, **kwargs): def register_signal_handlers(): Image = get_image_model() + Document = get_document_model() for model in get_page_models(): page_published.connect(purge_page_from_cache, sender=model) @@ -44,6 +45,7 @@ def register_signal_handlers(): def unregister_signal_handlers(): Image = get_image_model() + Document = get_document_model() for model in get_page_models(): page_published.disconnect(purge_page_from_cache, sender=model) diff --git a/wagtail/contrib/wagtailapi/endpoints.py b/wagtail/contrib/wagtailapi/endpoints.py index 5d0afa9b76..171679e6d9 100644 --- a/wagtail/contrib/wagtailapi/endpoints.py +++ b/wagtail/contrib/wagtailapi/endpoints.py @@ -12,7 +12,7 @@ from rest_framework.viewsets import GenericViewSet from wagtail.wagtailcore.models import Page from wagtail.wagtailcore.utils import resolve_model_string -from wagtail.wagtaildocs.models import Document +from wagtail.wagtaildocs.models import get_document_model from wagtail.wagtailimages.models import get_image_model from .filters import ChildOfFilter, DescendantOfFilter, FieldsFilter, OrderingFilter, SearchFilter @@ -239,4 +239,4 @@ class DocumentsAPIEndpoint(BaseAPIEndpoint): filter_backends = [FieldsFilter, OrderingFilter, SearchFilter] extra_api_fields = ['title', 'tags'] name = 'documents' - model = Document + model = get_document_model() diff --git a/wagtail/contrib/wagtailapi/signal_handlers.py b/wagtail/contrib/wagtailapi/signal_handlers.py index 4962bf2a2c..f3286edb0e 100644 --- a/wagtail/contrib/wagtailapi/signal_handlers.py +++ b/wagtail/contrib/wagtailapi/signal_handlers.py @@ -6,7 +6,7 @@ from django.db.models.signals import post_delete, post_save from wagtail.contrib.wagtailfrontendcache.utils import purge_url_from_cache from wagtail.wagtailcore.models import get_page_models from wagtail.wagtailcore.signals import page_published, page_unpublished -from wagtail.wagtaildocs.models import Document +from wagtail.wagtaildocs.models import get_document_model from wagtail.wagtailimages.models import get_image_model from .utils import get_base_url @@ -31,6 +31,7 @@ def purge_document_from_cache(instance, **kwargs): def register_signal_handlers(): Image = get_image_model() + Document = get_document_model() for model in get_page_models(): page_published.connect(purge_page_from_cache, sender=model) @@ -44,6 +45,7 @@ def register_signal_handlers(): def unregister_signal_handlers(): Image = get_image_model() + Document = get_document_model() for model in get_page_models(): page_published.disconnect(purge_page_from_cache, sender=model) diff --git a/wagtail/contrib/wagtailmedusa/renderers.py b/wagtail/contrib/wagtailmedusa/renderers.py index 552b793e01..ba9e9495f5 100644 --- a/wagtail/contrib/wagtailmedusa/renderers.py +++ b/wagtail/contrib/wagtailmedusa/renderers.py @@ -2,7 +2,7 @@ from __future__ import absolute_import, unicode_literals from django_medusa.renderers import StaticSiteRenderer from wagtail.wagtailcore.models import Site -from wagtail.wagtaildocs.models import Document +from wagtail.wagtaildocs.models import get_document_model class PageRenderer(StaticSiteRenderer): @@ -19,6 +19,8 @@ class PageRenderer(StaticSiteRenderer): class DocumentRenderer(StaticSiteRenderer): def get_paths(self): + Document = get_document_model() + # Return list of paths to documents return (doc.url for doc in Document.objects.all())