parent data of a page not supplied if parent is also a concept
wimfeijen opened this issue · comments
Wim Feijen commented
Dan Braghiș commented
Hey @wimfeijen,
the example page_preview
endpoint from the README uses the Wagtail core PagesAPIViewSet
which in turn makes use of PageSerializer
for the page model and PageParentField
for the parent attribute.
Now, in preview mode, especially when adding a new page, the DRF serializers can't really determine the parent.
You could override the serve_preview
method to pass the parent to the preview template and by extension to the preview API endpoint and then have your own serializer that will handle that.
Wim Feijen commented
Thanks for the pointer @zerolab , I will look into this when I have time!