Skip to content

feat: Headless readiness #7850

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

Merged
merged 43 commits into from
Jul 29, 2024
Merged

Conversation

fsbraun
Copy link
Member

@fsbraun fsbraun commented Mar 21, 2024

Description

Regular projects distribute their content through serving pages at their corresponding URL as defined in the page tree. This is achieved by adding path("", include(cms.urls)) to a project's urls.py. Also, the CMS requires CMS_TEMPLATES or CMS_TEMPLATE_DIR to be set.

This PR allows setting up headless-ready projects by:

  1. Not requiring path("", include(cms.urls)) being part of the projects URLs. All editing is done in the admin and the edit, structure and preview endpoints.

    The structure endpoint can be used on read-only objects (such as published pages), too, allowing to view the tree and copy plugins. All modifying actions are disabled for read-only objects.

  2. Not requiring any templates to be defined. If no templates are available, all interaction runs through the structure endpoint. While the editing experience might be limited, this can be a fast way of setting up a project.

  3. This PR moves the create wizard URL to the placeholder admin (which contains all editing endpoints) (but also keeps the previous endpoint in cms.urls for the wizard for compatibility reasons).

  4. The data bridge allows the frontend to update the structure board after changes in the plugin tree. This PR changes the HTML response for changes in the plugin tree from inlining the data in a script to a script tag containing JSON objects which are read and passed to the data bridge.

Related resources

Checklist

  • I have opened this pull request against develop-4
  • I have added or modified the tests when changing logic
  • I have followed the conventional commits guidelines to add meaningful information into the changelog
  • I have read the contribution guidelines and I have joined #workgroup-pr-review on Slack to find a “pr review buddy” who is going to review my pull request.

@fsbraun fsbraun added this to the 4.2 milestone Apr 20, 2024
@fsbraun fsbraun changed the title feat: Move data bridge data to script tags for easier extraction. feat: Allow headless projects and move data bridge data to script tags for easier extraction. May 7, 2024
@fsbraun fsbraun removed this from the 4.2 milestone May 8, 2024
@fsbraun fsbraun added the 4.1 label May 8, 2024
@fsbraun fsbraun marked this pull request as ready for review May 8, 2024 20:39
@fsbraun fsbraun requested review from marksweb and a team May 9, 2024 07:04
@vinitkumar
Copy link
Member

@fsbraun Great work on this. I would love to see how this works in practise and what we can do with it?

@fsbraun
Copy link
Member Author

fsbraun commented Jun 25, 2024

@macolo Thank youn for the comments!

I've tried to improve the clarity of the CMS_PLACEHOLDERS setting. It is supposed to replace CMS_TEMPLATES in a headless-only config.

@macolo
Copy link
Contributor

macolo commented Jun 26, 2024

@fsbraun the docs now make a lot of sense to me, easy to understand! 💪 I like the design of this functionality, it seems quite intuitive to me from a developer's perspective. 👍

@fsbraun fsbraun removed the 4.1 label Jul 29, 2024
@fsbraun fsbraun merged commit d0a25c0 into django-cms:develop-4 Jul 29, 2024
32 checks passed
@fsbraun fsbraun deleted the feat/data-bridge branch September 6, 2024 09:39
@fsbraun fsbraun restored the feat/data-bridge branch September 6, 2024 15:08
@fsbraun fsbraun deleted the feat/data-bridge branch September 19, 2024 14:18
@fsbraun fsbraun mentioned this pull request Sep 25, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants