Skip to content

Commit 3b85b4e

Browse files
author
Mark Gibbs
committed
Baked in second example app in migration
1 parent de94dcf commit 3b85b4e

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

demo/demo/templates/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
</div>
3030
<div>
3131
WS Content here
32-
{%plotly_app slug="connected-9"%}
32+
{%plotly_app slug="connected-2"%}
3333
</div>
3434
</body>
3535
{%plotly_message_pipe%}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE HTML>
2+
<html>
3+
<head>
4+
{%load plotly_dash%}
5+
<title>More Examples</title>
6+
</head>
7+
<body>
8+
<div>
9+
<p>Navigational links :
10+
<a href="{%url "home"%}">Main Page</a>
11+
<a href="{%url "second"%}">Second Page</a>
12+
</p>
13+
</div>
14+
<div>
15+
WS Content here
16+
{%plotly_app name="Connected"%}
17+
</div>
18+
<div>
19+
WS Content here
20+
{%plotly_app slug="connected-2"%}
21+
</div>
22+
</body>
23+
</html>

django_plotly_dash/migrations/0002_add_examples.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,33 @@ def addExamples(apps, schema_editor):
1919

2020
da1.save()
2121

22+
sa2 = StatelessApp(app_name="Connected",
23+
slug="connected")
24+
25+
sa2.save()
26+
27+
da2 = DashApp(stateless_app=sa2,
28+
instance_name="Connected-2",
29+
slug="connected-2",
30+
base_state='''{"dynamic": {"value": "Dynamo 123",
31+
"uid": "need_to_generate_this",
32+
"channel_name": "test_widget_channel",
33+
"label": "rotational energy"},
34+
"dropdown-one": {"value": "Oxygen"},
35+
"also_dynamic": {"value": "Alternator 456",
36+
"uid": "and_this_one",
37+
"channel_name": "test_widget_channel",
38+
"label": "momentum"}}''',
39+
save_on_change=True)
40+
41+
da2.save()
42+
2243

2344
def remExamples(apps, schema_editor):
2445

46+
DashApp = apps.get_model("django_plotly_dash","DashApp")
47+
StatelessApp = apps.get_model("django_plotly_dash","StatelessApp")
48+
2549
DashApp.objects.all().delete()
2650
StatelessApp.objects.all().delete()
2751

0 commit comments

Comments
 (0)