.. _frontend-editable-fields: ######################################################### How to enable frontend editing for Page and Django models ######################################################### .. versionadded:: 3.0 As well as ``PlaceholderFields``, 'ordinary' Django model fields (both on CMS Pages and your own Django models) can also be edited through django CMS's frontend editing interface. This is very convenient for the user because it saves having to switch between frontend and admin views. Using this interface, model instance values that can be edited show the "Double-click to edit" hint on hover. Double-clicking opens a pop-up window containing the change form for that model. .. note:: This interface is not currently available for touch-screen users, but will be improved in future releases. .. warning:: This feature is only partially compatible with django-hvad: using ``render_model`` with hvad-translated fields (say ``{% render_model object 'translated_field' %}`` returns an error if the hvad-enabled object does not exists in the current language. As a workaround ``render_model_icon`` can be used instead. .. _render_model_templatetags: ************* Template tags ************* This feature relies on five template tags sharing common code. All require that you ``{% load cms_tags %}`` in your template: * :ttag:`render_model` (for editing a specific field) * :ttag:`render_model_block` (for editing any of the fields in a defined block) * :ttag:`render_model_icon` (for editing a field represented by another value, such as an image) * :ttag:`render_model_add` (for adding an instance of the specified model) * :ttag:`render_model_add_block` (for adding an instance of the specified model) Look at the tag-specific page for more detailed reference and discussion of limitations and caveats. **************** Page titles edit **************** For CMS pages you can edit the titles from the frontend; according to the attribute specified a default field, which can also be overridden, will be editable. Main title:: {% render_model request.current_page "title" %} Page title:: {% render_model request.current_page "page_title" %} Menu title:: {% render_model request.current_page "menu_title" %} All three titles:: {% render_model request.current_page "titles" %} You can always customise the editable fields by providing the `edit_field` parameter:: {% render_model request.current_page "title" "page_title,menu_title" %} ************** Page menu edit ************** By using the special keyword ``changelist`` as edit field the frontend editing will show the page tree; a common pattern for this is to enable changes in the menu by wrapping the menu template tags: .. code-block:: html+django {% render_model_block request.current_page "changelist" %}

Menu

{% endrender_model_block %} Will render to: .. code-block:: html+django