django-plotly-dash icon indicating copy to clipboard operation
django-plotly-dash copied to clipboard

Redirect from Dash app back to Django home page

Open mouhannadali opened this issue 3 years ago • 4 comments

I was able to redirect to a dash app from Django using the tag: ` {%load plotly_dash%}

but couldn't find a way to navigate (redirect) back to the Django home page template. any idea??

mouhannadali avatar Dec 22 '21 17:12 mouhannadali

When you register you urls, you can name each route. Insert a link back to the homepage using something like {% url "home"%} where home should be replaced by the name of the route.

See the django documentation for more info. Google will be your friend here.

GibbsConsulting avatar Dec 25 '21 04:12 GibbsConsulting

hi @GibbsConsulting , in Django HTML template I can add a href={% url "home"%} but I am not able to use it inside the plotly dash app I tried to do something like this

  dbc.Button(
      "Skip", id="skip-button", external_link=True, href="../../", outline=True,
  ),

it opens the home page but inside the dash app layout ...

mouhannadali avatar Dec 25 '21 14:12 mouhannadali

Ah OK, you want to be able to say to the outer page, from the inner iframe, 'please go to X'. I suspect your alternatives are (a) dont use the iframe version of the template, which does have other implications such as the lack of encapsulation, or (b) some javascript to communicate to the outer page.

The latter would be a nice feature to have in general, as would the closely related one of allowing separate dash apps on the same page to communicate with each other.

GibbsConsulting avatar Feb 03 '22 23:02 GibbsConsulting

Has anyone been able to solve this? I am unable to use the non-iframe version as i need to input some initial_arguments.

hetryn avatar Apr 27 '24 09:04 hetryn