Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parent data of a page not supplied if parent is also a concept #57

Open
wimfeijen opened this issue Dec 15, 2023 · 2 comments
Open

parent data of a page not supplied if parent is also a concept #57

wimfeijen opened this issue Dec 15, 2023 · 2 comments

Comments

@wimfeijen
Copy link

Hi,

If we are previewing a concept page with a parent which is also in concept status, page_data['meta']['parent'] is not supplied.

However, in preview mode, I would like to have access to the parent data as well, even if it is a concept. For example:
Screenshot 2023-12-15 at 15 09 16

@zerolab
Copy link
Member

zerolab commented Dec 15, 2023

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.

@wimfeijen
Copy link
Author

Thanks for the pointer @zerolab , I will look into this when I have time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants