Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ Then, add ``django_plotly_dash`` to ``INSTALLED_APPS`` in the Django ``settings.
...
]

Further, if the :ref:`header and footer <plotly_header_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.

Expand Down
33 changes: 26 additions & 7 deletions docs/template_tags.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <plotly_header_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

Expand All @@ -100,9 +102,26 @@ folllows:
{% plotly_footer %}
</html>

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 <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 <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
----------------------------------------
Expand Down