diff --git a/docs/installation.rst b/docs/installation.rst index ff0a7844..e97a81a5 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -17,6 +17,9 @@ Then, add ``django_plotly_dash`` to ``INSTALLED_APPS`` in the Django ``settings. ... ] +Further, if the :ref:`header and footer ` tags are in use +then ``django_plotly_dash.middleware.BaseMiddleware`` should be added to ``MIDDLEWARE`` in the same file. This can be safely added now even if not used. + The project directory name ``django_plotly_dash`` can also be used on its own if preferred, but this will stop the use of readable application names in the Django admin interface. diff --git a/docs/template_tags.rst b/docs/template_tags.rst index 1f59a9d9..f9474965 100644 --- a/docs/template_tags.rst +++ b/docs/template_tags.rst @@ -68,16 +68,18 @@ the page there are no arguments to control the size of the iframe. This tag should not appear more than once on a page. This rule however is not enforced at present. -.. _plotly_message_pipe: +If this tag is used, then the :ref:`header and footer ` tags should also be +added to the template. Note that these tags in turn have middleware requirements. +.. _plotly_header_footer: -The ``plotly_header`` and ``plotly_footer`` template tag --------------------------------------------------------- +The ``plotly_header`` and ``plotly_footer`` template tags +--------------------------------------------------------- ``DjangoDash`` allows you to inject directly the html generated by ``Dash`` in -the DOM of the page (without iframe). To include your app CSS and JS, you have -to include 2 tags in your template ``plotly_header`` and ``plotly_footer``, as -folllows: +the DOM of the page without wrapping it in an iframe. To include your app CSS and JS, you have +to include two tags in your template, namely ``plotly_header`` and ``plotly_footer``, as +follows: .. code-block:: jinja @@ -100,9 +102,26 @@ folllows: {% plotly_footer %} -This part in mandatory if you want to use ``plotly_direct`` tag. +This part in mandatory if you want to use the :ref:`plotly_direct ` tag, and these two tags can safely be included +on any page that has loaded the ``plotly_dash`` template tag library with minimal overhead. Neither tag has +any arguments. + +Note that if you are using any functionality that needs the use of these tags, then the associated middleware +should be added in ``settings.py`` as mentioned in the :ref:`installation ` section. + +.. code-block:: python + + MIDDLEWARE = [ + ... + 'django_plotly_dash.middleware.BaseMiddleware', + ] + + +This middleware should appear low down the middleware list. + +.. _plotly_message_pipe: The ``plotly_message_pipe`` template tag ----------------------------------------