Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions src/wagtailbakery/api_views.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import os
import json
import logging
import os

from bakery.views import BuildableMixin
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from wagtail.api.v2.endpoints import PagesAPIEndpoint
from wagtail.api.v2.router import WagtailAPIRouter
from bakery.views import BuildableMixin

from wagtail.core.models import Page, Site
from wagtail.api.v2.router import WagtailAPIRouter
from wagtail.api.v2.endpoints import PagesAPIEndpoint

from django.contrib.contenttypes.models import ContentType

logger = logging.getLogger(__name__)

BAKERY_RESULTS_PER_PAGE = getattr(settings, 'BAKERY_RESULTS_PER_PAGE', 25)


class APIResponseError(Exception):
pass
Expand All @@ -24,7 +28,7 @@ def handle_api_error(response):


class APIListingView(BuildableMixin):
results_per_page = 20
results_per_page = BAKERY_RESULTS_PER_PAGE

@property
def build_method(self):
Expand Down Expand Up @@ -85,7 +89,7 @@ def build_object(self, obj):
self.build_file(path, page_content)

def build_queryset(self):
[self.build_object(o) for o in self.get_queryset().all()]
[self.build_object(o) for o in self.get_queryset().all() if o.is_root() is False]

def unbuild_object(self, obj):
"""
Expand Down