8000 feat: Add `FrontendEditableAdminMixin` endpoint to plugins by fsbraun · Pull Request #8062 · django-cms/django-cms · GitHub
[go: up one dir, main page]

Skip to content

feat: Add FrontendEditableAdminMixin endpoint to plugins #8062

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 20 commits into from
Nov 7, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add docs
  • Loading branch information
fsbraun committed Nov 5, 2024
commit bc744ca2541b4781b462537e1d0080db38707390
42 changes: 41 additions & 1 deletion docs/how_to/06-frontend_models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ All three titles::


You can always customise the editable fields by providing the
`edit_field` parameter::
``edit_field`` parameter::

{% render_model request.current_page "title" "page_title,menu_title" %}

Expand Down Expand Up @@ -282,3 +282,43 @@ the standard ``as`` syntax:

{% endblock content %}


*******
Plugins
*******

.. versionadded:: 4.2

Exposing plugins for frontend editing is a new feature in django CMS 4.2.


The frontend editing feature is also available for plugins. While by definition
plugins are frontend-editable, you can still use the template tags to expose
only selected fields for editing.

Say, you have a header plugin that contains a section header and a summary
of the section content. You can expose only the header for editing::

{% load cms_tags %}

{% block content %}
<h1>{% render_model instance "header" "header" %}</h1>
{% endblock content %}

This will render ``{{ instance.header }}`` and double-clicking on it will open
a pop-up window with the change form for the plugin instance with the header field
only.

An alternative is to use the ``render_model_block`` template tag::

{% load cms_tags %}

{% block content %}
<h1>{% render_model_block instance "header" %}
{{ instance.header }}
{% endrender_model_block %}</h1>
{% endblock content %}

Third party packages such as djangocms-text use this feature to allow inline
editing of single fields in the frontend.

0