Permalink
Browse files

a note for the docs

  • Loading branch information...
1 parent 7222147 commit be675eda3687c247c1cc7b1599b8b204b5288cc5 @evildmp evildmp committed Jan 17, 2013
Showing with 28 additions and 4 deletions.
  1. +28 −4 docs/extending_cms/custom_plugins.rst
@@ -352,11 +352,35 @@ Since :class:`cms.plugin_base.CMSPluginBase` extends
:class:`django.contrib.admin.options.ModelAdmin`, you can customize the form
for your plugins just as you would customize your admin interfaces.
-.. note::
+The template that the plugin editing mechanism uses is
+``cms/templates/admin/cms/page/plugin_change_form.html``. You might need to
+change this.
- If you want to overwrite the form be sure to extend from
- ``admin/cms/page/plugin_change_form.html`` to have a unified look across the
- plugins and to have the preview functionality automatically installed.
+If you want to customise this the best way to do it is:
+
+* create a template of your own that extends ``cms/templates/admin/cms/page/plugin_change_form.html`` to provide the functionality you require
+* provide your :class:`cms.plugin_base.CMSPluginBase` subclass with a ``change_form_template`` attribute pointing at your new template
+
+Extending ``admin/cms/page/plugin_change_form.html`` ensures that you'll keep
+a unified look and functionality across your plugins.
+
+There are various reasons *why* you might want to do this. For example, you
+might have a snippet of JavaScript that needs to refer to a template
+variable), which you'd likely place in ``{% block extrahead %}``, after a ``{{
+block.super }}`` to inherit the existing items that were in the parent
+template.
+
+
+Or: ``cms/templates/admin/cms/page/plugin_change_form.html`` extends Django's
+own ``admin/base_site.html``, which loads a rather elderly version of jQuery,
+and your plugin admin might require something newer. In this case, in your
+custom ``change_form_template`` you could do something like::
+
+ {% block jquery %}
+ <script type="text/javascript" src="///ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script>
+ {% endblock jquery %}``
+
+to override the ``{% block jquery %}``.
.. _custom-plugins-handling-media:

0 comments on commit be675ed

Please sign in to comment.