Skip to content

Commit ba772a4

Browse files
Merge pull request #5 from delsim/master
Adding state management
2 parents 280f9dc + f4e28af commit ba772a4

26 files changed

+438
-82
lines changed

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@ Expose [plotly dash](https://plot.ly/products/dash/) apps as django tags.
55
See the source for this project here:
66
<https://github.com/GibbsConsulting/django-plotly-dash>
77

8-
Online documentation can be found here:
8+
This README file provides a short guide to installing and using the package, and also
9+
outlines how to run the demonstration application.
10+
11+
More detailed information
12+
can be found in the online documentation at
913
<https://readthedocs.org/projects/django-plotly-dash>
1014

15+
1116
## Installation
1217

1318
First, install the package. This will also install plotly and some dash packages if they are not already present.
@@ -18,7 +23,7 @@ Then, just add `django_plotly_dash` to `INSTALLED_APPS` in your Django `settings
1823

1924
INSTALLED_APPS = [
2025
...
21-
'django_plotly_dash',
26+
'django_plotly_dash.apps.DjangoPlotlyDashConfig',
2227
...
2328
]
2429

@@ -110,6 +115,6 @@ templates:
110115
```
111116

112117
The registration code needs to be in a location
113-
that will be imported into the Django process before any template tag attempts to use it. The example Django application
118+
that will be imported into the Django process before any model or template tag attempts to use it. The example Django application
114119
in the demo subdirectory achieves this through an import in the main urls.py file; any views.py would also be sufficient.
115120

demo/configdb.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env python
2+
#
3+
# Create a new superuser
4+
from django.contrib.auth import get_user_model
5+
6+
UserModel = get_user_model()
7+
8+
name="admin"
9+
password="admin"
10+
11+
try:
12+
UserModel.objects.get(username=name)
13+
except:
14+
su = UserModel.objects.create_user(name,password=password)
15+
su.is_staff=True
16+
su.is_superuser=True
17+
su.save()

demo/demo/plotly_apps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def callback_size(dropdown_color, dropdown_size):
4444
html.Div(id="output-one")
4545
])
4646

47-
@a2.callback(
47+
@a2.expanded_callback(
4848
dash.dependencies.Output('output-one','children'),
4949
[dash.dependencies.Input('dropdown-one','value')]
5050
)

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 = [

demo/demo/templates/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<body>
66
<div>
77
Content here
8-
{%plotly_item "SimpleExample"%}
8+
{%plotly_item "simpleexample-1" ratio=0.2 %}
99
</div>
1010
<div>
1111
Content here

dev_requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ dash-html-components==0.10.1
1010
dash-renderer==0.12.1
1111
decorator==4.3.0
1212
Django==2.0.5
13-
-e git+https://github.com/delsim/django-plotly-dash.git@293b454ee8965422155a971d9e417878dc89ce82#egg=django_plotly_dash
1413
docopt==0.6.2
1514
docutils==0.14
1615
Flask==1.0.2

django_plotly_dash/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#
22

3-
__version__ = "0.0.3"
3+
__version__ = "0.0.4"
44

55
from .dash_wrapper import DelayedDash
66

django_plotly_dash/admin.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
from django.contrib import admin
22

3-
# Register your models here.
3+
from .models import DashApp, DashAppAdmin
4+
5+
admin.site.register(DashApp, DashAppAdmin)
6+

django_plotly_dash/app_name.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
app_name = "the_django_plotly_dash"
2+
main_view_label = "main"

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"

0 commit comments

Comments
 (0)