Skip to content

Commit f0d04a1

Browse files
author
Mark Gibbs
committed
Added a demo of direct html injection
1 parent a29fbd0 commit f0d04a1

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

demo/demo/templates/demo_five.html

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{%extends "base.html"%}
2+
{%load plotly_dash%}
3+
4+
{%block title%}Demo One - Simple Embedding{%endblock%}
5+
6+
{%block content%}
7+
<h1>Simple App Embedding</h1>
8+
<p>
9+
This is a simple example of use of a dash application within a Django template. Use of
10+
the plotly_app template tag with the name of a dash application represents the simplest use of
11+
the django_plotly_dash framework.
12+
</p>
13+
<p>
14+
The plotly_class tag is also used to wrap the application in css class names based on the
15+
application (django-plotly-dash), the
16+
type of the embedding (iframe), and the slugified version of the app name (simpleexample).
17+
</p>
18+
<div class="card bg-light border-dark">
19+
<div class="card-body">
20+
<p><span>{</span>% load plotly_dash %}</p>
21+
<p>&lt;div class="<span>{</span>% plotly_class name="SimpleExample"%}">
22+
<p class="ml-3"><span>{</span>% plotly_direct name="SimpleExample" %}</p>
23+
<p>&lt;\div>
24+
</div>
25+
</div>
26+
<p></p>
27+
<div class="card border-dark">
28+
<div class="card-body">
29+
<div class="{%plotly_class name="SimpleExample"%}">
30+
{%plotly_direct name="SimpleExample"%}
31+
</div>
32+
</div>
33+
</div>
34+
<p></p>
35+
{%endblock%}

demo/demo/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
url('^demo-two$', TemplateView.as_view(template_name='demo_two.html'), name="demo-two"),
3737
url('^demo-three$', TemplateView.as_view(template_name='demo_three.html'), name="demo-three"),
3838
url('^demo-four$', TemplateView.as_view(template_name='demo_four.html'), name="demo-four"),
39+
url('^demo-five$', TemplateView.as_view(template_name='demo_five.html'), name="demo-five"),
3940
url('^admin/', admin.site.urls),
4041
url('^django_plotly_dash/', include('django_plotly_dash.urls')),
4142

0 commit comments

Comments
 (0)