diff --git a/django_plotly_dash/dash_wrapper.py b/django_plotly_dash/dash_wrapper.py index 47ba4342..d506037c 100644 --- a/django_plotly_dash/dash_wrapper.py +++ b/django_plotly_dash/dash_wrapper.py @@ -437,7 +437,15 @@ def _fix_callback_item(self, item): def callback(self, output, inputs=[], state=[], events=[]): # pylint: disable=dangerous-default-value 'Invoke callback, adjusting variable names as needed' - return super(WrappedDash, self).callback(self._fix_callback_item(output), + + if isinstance(output, (list, tuple)): + fixed_outputs = [self._fix_callback_item(x) for x in output] + # Temporary check; can be removed once the library has been extended + raise NotImplementedError("django-plotly-dash cannot handle multiple callback outputs at present") + else: + fixed_outputs = self._fix_callback_item(output) + + return super(WrappedDash, self).callback(fixed_outputs, [self._fix_callback_item(x) for x in inputs], [self._fix_callback_item(x) for x in state]) @@ -520,6 +528,7 @@ def index(self, *args, **kwargs): # pylint: disable=unused-argument css = self._generate_css_dist_html() config = self._generate_config_html() metas = self._generate_meta_html() + renderer = self._generate_renderer() title = getattr(self, 'title', 'Dash') if self._favicon: import flask @@ -537,14 +546,13 @@ def index(self, *args, **kwargs): # pylint: disable=unused-argument ''' index = self.interpolate_index( metas=metas, title=title, css=css, config=config, - scripts=scripts, app_entry=_app_entry, favicon=favicon) + scripts=scripts, app_entry=_app_entry, favicon=favicon, + renderer=renderer) return index def interpolate_index(self, **kwargs): #pylint: disable=arguments-differ - print("IN INTERPOLATE INDEX") - if not self._return_embedded: resp = super(WrappedDash, self).interpolate_index(**kwargs) return resp diff --git a/django_plotly_dash/version.py b/django_plotly_dash/version.py index 56ca9c7f..52cfb928 100644 --- a/django_plotly_dash/version.py +++ b/django_plotly_dash/version.py @@ -23,4 +23,4 @@ ''' -__version__ = "0.9.8" +__version__ = "0.9.9" diff --git a/django_plotly_dash/views.py b/django_plotly_dash/views.py index 27148e14..810d3a39 100644 --- a/django_plotly_dash/views.py +++ b/django_plotly_dash/views.py @@ -90,8 +90,16 @@ def update(request, ident, stateless=False, **kwargs): if str(resp) == 'EDGECASEEXIT': return HttpResponse("") - return HttpResponse(resp.data, - content_type=resp.mimetype) + # Change in returned value type + try: + rdata = resp.data + rtype = resp.mimetype + except: + rdata = resp + rtype = "application/json" + + return HttpResponse(rdata, + content_type=rtype) def main_view(request, ident, stateless=False, cache_id=None, **kwargs): 'Main view for a dash app' diff --git a/frozen_dev.txt b/frozen_dev.txt index 4236a106..0c8a1191 100644 --- a/frozen_dev.txt +++ b/frozen_dev.txt @@ -6,35 +6,35 @@ astroid==2.0.4 async-timeout==2.0.1 atomicwrites==1.2.1 attrs==18.2.0 -autobahn==18.9.2 +autobahn==18.8.2 Automat==0.7.0 Babel==2.6.0 -bleach==3.0.2 certifi==2018.8.24 -cffi==1.11.5 channels==2.1.3 channels-redis==2.3.0 chardet==3.0.4 -Click==7.0 -cmarkgfm==0.4.2 +click==6.7 constantly==15.1.0 coverage==4.5.1 daphne==2.2.2 -dash==0.36 -dash-core-components==0.43 -dash-html-components==0.13.5 -dash-renderer==0.17 +dash==0.41.0 +dash-bootstrap-components==0.2.6 +dash-core-components==0.46.0 +dash-html-components==0.15.0 +dash-renderer==0.22.0 +dash-table==3.6.0 decorator==4.3.0 -Django==2.1.2 +Django==2.1.1 django-bootstrap4==0.0.7 --e git+https://github.com/delsim/django-plotly-dash.git@affccd8b280b2fdbc7f7e2d975b9cf4c7ace5f06#egg=django_plotly_dash +django-pdb==0.6.2 +-e git+https://github.com/delsim/django-plotly-dash.git@883dbd9969a993cfb5a5b34c62b658f13ac0d613#egg=django_plotly_dash django-redis==4.9.0 docopt==0.6.2 docutils==0.14 dpd-components==0.1.0 +dpd-static-support==0.0.2 Flask==1.0.2 Flask-Compress==1.4.0 -future==0.16.0 grip==4.5.2 hiredis==0.2.0 hyperlink==18.0.0 @@ -49,13 +49,13 @@ jsonschema==2.6.0 jupyter-core==4.4.0 lazy-object-proxy==1.3.1 livereload==2.5.2 -Markdown==3.0.1 +Markdown==2.6.11 MarkupSafe==1.0 mccabe==0.6.1 more-itertools==4.3.0 msgpack==0.5.6 nbformat==4.4.0 -numpy==1.15.2 +numpy==1.15.1 packaging==18.0 pandas==0.23.4 path-and-address==2.0.1 @@ -63,22 +63,20 @@ pathlib2==2.3.2 pathtools==0.1.2 pkg-resources==0.0.0 pkginfo==1.4.2 -plotly==3.5.0 +plotly==3.4.2 pluggy==0.7.1 port-for==0.3.1 -py==1.7.0 -pycparser==2.19 +py==1.6.0 Pygments==2.2.0 PyHamcrest==1.9.0 pylint==2.1.1 -pyparsing==2.2.2 -pytest==3.8.2 -pytest-cov==2.6.0 -pytest-django==3.4.3 +pyparsing==2.3.0 +pytest==3.7.4 +pytest-cov==2.5.1 +pytest-django==3.4.2 python-dateutil==2.7.3 pytz==2018.5 PyYAML==3.13 -readme-renderer==22.0 redis==2.10.6 requests==2.19.1 requests-toolbelt==0.8.0 @@ -89,16 +87,16 @@ Sphinx==1.8.1 sphinx-autobuild==0.7.1 sphinx-rtd-theme==0.4.2 sphinxcontrib-websupport==1.1.0 -tornado==5.1.1 -tqdm==4.26.0 +tornado==5.1 +tqdm==4.25.0 traitlets==4.3.2 -twine==1.12.1 +twine==1.11.0 Twisted==18.7.0 txaio==18.8.1 typed-ast==1.1.0 urllib3==1.23 watchdog==0.9.0 -webencodings==0.5.1 Werkzeug==0.14.1 +whitenoise==4.1.2 wrapt==1.10.11 zope.interface==4.5.0 diff --git a/requirements.txt b/requirements.txt index baf08dac..c12bbb7a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ -dash==0.38 -dash-core-components==0.43.1 -dash-html-components==0.13.5 -dash-renderer==0.19 +dash +dash-core-components +dash-html-components +dash-renderer plotly dpd-components