Skip to content

Commit 69d9b89

Browse files
author
Mark Gibbs
committed
Refactored DelayedDash into DjangoDash class. Extended documentation scope
1 parent 8951bcf commit 69d9b89

File tree

9 files changed

+34
-16
lines changed

9 files changed

+34
-16
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ cd django-plotly-dash
4545

4646
## Usage
4747

48-
To use existing dash applications, first register them using the `DelayedDash` class. This
48+
To use existing dash applications, first register them using the `DjangoDash` class. This
4949
replaces the `Dash` class of the `dash` package.
5050

5151
Taking a very simple example inspired by the excellent [getting started](https://dash.plot.ly/) documentation:
@@ -55,9 +55,9 @@ import dash
5555
import dash_core_components as dcc
5656
import dash_html_components as html
5757

58-
from django_plotly_dash import DelayedDash
58+
from django_plotly_dash import DjangoDash
5959

60-
app = DelayedDash('SimpleExample')
60+
app = DjangoDash('SimpleExample')
6161

6262
app.layout = html.Div([
6363
dcc.RadioItems(
@@ -90,7 +90,7 @@ def callback_size(dropdown_color, dropdown_size):
9090
dropdown_color)
9191
```
9292

93-
Note that the `DelayedDash` constructor requires a name to be specified. This name is then used to identify the dash app in
93+
Note that the `DjangoDash` constructor requires a name to be specified. This name is then used to identify the dash app in
9494
templates:
9595

9696
```jinja2

demo/demo/plotly_apps.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
import dash_core_components as dcc
33
import dash_html_components as html
44

5-
from django_plotly_dash import DelayedDash
5+
from django_plotly_dash import DjangoDash
66

7-
app = DelayedDash('SimpleExample')
7+
app = DjangoDash('SimpleExample')
88

99
app.layout = html.Div([
1010
dcc.RadioItems(
@@ -36,7 +36,7 @@ def callback_size(dropdown_color, dropdown_size):
3636
return "The chosen T-shirt is a %s %s one." %(dropdown_size,
3737
dropdown_color)
3838

39-
a2 = DelayedDash("Ex2")
39+
a2 = DjangoDash("Ex2")
4040
a2.layout = html.Div([
4141
dcc.RadioItems(id="dropdown-one",options=[{'label':i,'value':j} for i,j in [
4242
("O2","Oxygen"),("N2","Nitrogen"),]

django_plotly_dash/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
__version__ = "0.0.4"
44

5-
from .dash_wrapper import DelayedDash
5+
from .dash_wrapper import DjangoDash
66

django_plotly_dash/dash_wrapper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def add_usable_app(name, app):
2323

2424
def get_stateless_by_name(name):
2525
'''
26-
Locate a registered dash app by name, and return a DelayedDash instance encapsulating the app.
26+
Locate a registered dash app by name, and return a DjangoDash instance encapsulating the app.
2727
'''
2828
name = slugify(name)
2929
# TODO wrap this in raising a 404 if not found
@@ -37,7 +37,7 @@ def append_css(self, stylesheet):
3737
def append_script(self, script):
3838
self.items.append(script)
3939

40-
class DelayedDash:
40+
class DjangoDash:
4141
def __init__(self, name=None, **kwargs):
4242
if name is None:
4343
global uid_counter

docs/extended_callbacks.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.. _extended_callbacks:
2+
3+
Extended callback syntax
4+
========================
5+
6+
The ``DjangoDash`` class allows callbacks to request extra arguments when registered.

docs/index.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ Contents
1717
introduction
1818
installation
1919
simple_use
20+
extended_callbacks
21+
template_tags
22+
models_and_state
2023

2124

2225
Indices and tables

docs/models_and_state.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.. _models_and_state:
2+
3+
Django models and application state
4+
================

docs/simple_use.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
.. _simple_use:
22

3-
Simple Usage
3+
Simple usage
44
============
55

6-
To use existing dash applications, first register them using the ``DelayedDash`` class. This
6+
To use existing dash applications, first register them using the ``DjangoDash`` class. This
77
replaces the ``Dash`` class from the ``dash`` package.
88

99
Taking a simple example inspired by the excellent `getting started <https://dash.plot.ly/getting-started-part-2>`_ guide::
@@ -12,9 +12,9 @@ Taking a simple example inspired by the excellent `getting started <https://dash
1212
import dash_core_components as dcc
1313
import dash_html_components as html
1414

15-
from django_plotly_dash import DelayedDash
15+
from django_plotly_dash import DjangoDash
1616

17-
app = DelayedDash('SimpleExample') # replaces dash.Dash
17+
app = DjangoDash('SimpleExample') # replaces dash.Dash
1818

1919
app.layout = html.Div([
2020
dcc.RadioItems(
@@ -47,8 +47,8 @@ Taking a simple example inspired by the excellent `getting started <https://dash
4747
return "The chosen T-shirt is a %s %s one." %(dropdown_size,
4848
dropdown_color)
4949

50-
Note that the ``DelayedDash`` constructor requires a name to be specified. This name is then used to identify the dash app in
51-
templates:::
50+
Note that the ``DjangoDash`` constructor requires a name to be specified. This name is then used to identify the dash app
51+
in templates::
5252

5353
{%load plotly_dash%}
5454

docs/template_tags.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.. _template_tags:
2+
3+
Template tags
4+
=============
5+

0 commit comments

Comments
 (0)