Skip to content

Commit 736d9d5

Browse files
author
Mark Gibbs
committed
Tidy up documentation, and update code following advice from linter
1 parent 9c702c7 commit 736d9d5

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

django_plotly_dash/dash_wrapper.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def before_first_request(self, *args, **kwargs):
197197
pass
198198
def run(self, *args, **kwargs):
199199
pass
200-
def register_blueprint(*args, **kwargs):
200+
def register_blueprint(self, *args, **kwargs):
201201
pass
202202

203203
class WrappedDash(Dash):
@@ -415,6 +415,7 @@ def dispatch_with_args(self, body, argMap):
415415
return res
416416

417417
def slugified_id(self):
418+
'Return the app id in a slug-friendly form'
418419
pre_slugified_id = self._uid
419420
return slugify(pre_slugified_id)
420421

@@ -436,4 +437,4 @@ def extra_html_properties(self, prefix=None, posfix=None, template_type=None):
436437
'post_part':post_part,
437438
'template_type':template_type,
438439
'prefix':prefix,
439-
}
440+
}

django_plotly_dash/templatetags/plotly_dash.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def plotly_message_pipe(context, url=None):
7575

7676
@register.simple_tag()
7777
def plotly_app_identifier(name=None, slug=None, da=None, postfix=None):
78+
'Return a slug-friendly identifier'
7879
if name is not None:
7980
da, app = DashApp.locate_item(name, stateless=True)
8081

@@ -92,6 +93,7 @@ def plotly_app_identifier(name=None, slug=None, da=None, postfix=None):
9293

9394
@register.simple_tag()
9495
def plotly_class(name=None, slug=None, da=None, prefix=None, postfix=None, template_type=None):
96+
'Return a string of space-separated class names'
9597

9698
if name is not None:
9799
da, app = DashApp.locate_item(name, stateless=True)

docs/template_tags.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ The tag arguments are:
7878
:da = None: An existing ``django_plotly_dash.models.DashApp`` model instance.
7979
:postfix = None: An optional string; if specified it is appended to the identifier with a hyphen.
8080

81-
The validity rules for these arguments are the same as those for the ``plotly_app`` template tag.
81+
The validity rules for these arguments are the same as those for the ``plotly_app`` template tag. If
82+
supplied, the ``postfix`` argument
83+
should already be in a slug-friendly form, as no processing is performed on it.
8284

8385
The ``plotly_class`` template tag
8486
-----------------------------------------
@@ -109,4 +111,6 @@ The tag inserts a string with three class names in it. One is just the ``prefix`
109111
has the ``template_type`` appended, and the final one has the app identifier (as generated
110112
by the ``plotly_app_identifier`` tag) and any ``postfix`` appended.
111113

112-
The validity rules for these arguments are the same as those for the ``plotly_app`` template tag.
114+
The validity rules for these arguments are the same as those for the ``plotly_app`` and ``plotly_app_identifier`` template tags. Note
115+
that none of the ``prefix``, ``postfix`` and ``template_type`` arguments are modified and they should
116+
already be in a slug-friendly form, or otherwise fit for their intended purpose.

0 commit comments

Comments
 (0)