Skip to content

Commit

Permalink
Merge pull request GibbsConsulting#70 from delsim/improve_demo
Browse files Browse the repository at this point in the history
Added site lookup for curl url in demo
  • Loading branch information
GibbsConsulting authored Nov 8, 2018
2 parents da8c36c + ecf56d7 commit a52a13c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion demo/demo/templates/demo_four.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ <h1>Live Updating</h1>
</p>
<div class="card bg-light border-dark">
<div class="card-body">
curl http://localhost:8000/dpd/views/poke/ -d'{"channel_name":"live_button_counter","label":"named_counts","value":{"click_colour":"red"}}'
curl http://{%site_root_url%}/dpd/views/poke/ -d'{"channel_name":"live_button_counter","label":"named_counts","value":{"click_colour":"red"}}'
</div>
</div>
<p></p>
Expand Down
2 changes: 1 addition & 1 deletion django_plotly_dash/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
SOFTWARE.
'''

__version__ = "0.9.2"
__version__ = "0.9.3"

from .dash_wrapper import DjangoDash
7 changes: 7 additions & 0 deletions django_plotly_dash/templatetags/plotly_dash.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
from django import template
from django.core.cache import cache

from django.contrib.sites.shortcuts import get_current_site

from django_plotly_dash.models import DashApp
from django_plotly_dash.util import pipe_ws_endpoint_name, cache_timeout_initial_arguments

Expand Down Expand Up @@ -139,3 +141,8 @@ def plotly_class(name=None, slug=None, da=None, prefix=None, postfix=None, templ
return app.extra_html_properties(prefix=prefix,
postfix=postfix,
template_type=template_type)

@register.simple_tag(takes_context=True)
def site_root_url(context):
current_site_url = get_current_site(context.request)
return current_site_url.domain

0 comments on commit a52a13c

Please sign in to comment.