Skip to content

Commit ef27a17

Browse files
author
Mark Gibbs
committed
Added data migration for simple example
1 parent eae96bb commit ef27a17

File tree

5 files changed

+38
-5
lines changed

5 files changed

+38
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Then, just add `django_plotly_dash` to `INSTALLED_APPS` in your Django `settings
2323

2424
INSTALLED_APPS = [
2525
...
26-
'django_plotly_dash',
26+
'django_plotly_dash.apps.DjangoPlotlyDashConfig',
2727
...
2828
]
2929

demo/demo/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
'django.contrib.messages',
3939
'django.contrib.staticfiles',
4040

41-
'django_plotly_dash',
41+
'django_plotly_dash.apps.DjangoPlotlyDashConfig',
4242
]
4343

4444
MIDDLEWARE = [

django_plotly_dash/apps.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33

44
class DjangoPlotlyDashConfig(AppConfig):
55
name = 'django_plotly_dash'
6+
verbose_name = "Django Plotly Dash"
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Generated by Django 2.0.5 on 2018-05-10 23:26
2+
3+
from django.db import migrations
4+
5+
def getDA(apps):
6+
return apps.get_model("django_plotly_dash","DashApp")
7+
8+
def forward(apps, schema_editor):
9+
DashApp = getDA(apps)
10+
da = DashApp(app_name="SimpleExample",
11+
instance_name="SimpleExample-1",
12+
slug="simpleexample-1",
13+
base_state='{"dropdown-color":{"value":"blue"},"dropdown-size":{"value":"small"}}')
14+
da.save()
15+
16+
def backward(apps, schema_editor):
17+
DashApp = getDA(apps)
18+
DashApp.objects.all().delete()
19+
20+
class Migration(migrations.Migration):
21+
22+
dependencies = [
23+
('django_plotly_dash', '0001_initial'),
24+
]
25+
26+
operations = [
27+
migrations.RunPython(forward, backward),
28+
]

docs/installation.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,18 @@ Then, add ``django_plotly_dash`` to ``INSTALLED_APPS`` in the Django settings.py
1111

1212
INSTALLED_APPS = [
1313
...
14-
'django_plotly_dash',
14+
'django_plotly_dash.apps.DjangoPlotlyDashConfig',
1515
...
1616
]
1717

18-
The plotly_item tag in the plotly_dash tag library can then be used to render any registered dash component. See :ref:`simple_use` for a simple example.
18+
The ``plotly_item`` tag in the ``plotly_dash`` tag library can then be used to render any registered dash component. See :ref:`simple_use` for a simple example.
19+
20+
The project directory name ``django_plotly_dash`` can also be used on its own if preferred, but this will then skip the use of readable application names in
21+
the Django admin interface.
1922

2023
Source code and demo
2124
--------------------
22-
25+
2
2326
The source code repository contains a simple demo application.
2427

2528
To install and run it::
@@ -36,3 +39,4 @@ To install and run it::
3639
# using the Django debug server
3740
# at http://localhost:8000
3841

42+
This will launch a simple Django application. A superuser account is also configured, with both username and password set to ``admin``.

0 commit comments

Comments
 (0)