diff --git a/turbo_flask/turbo.py b/turbo_flask/turbo.py index c3dd2fb..1a7b872 100644 --- a/turbo_flask/turbo.py +++ b/turbo_flask/turbo.py @@ -6,7 +6,7 @@ _CDN = 'https://cdn.skypack.dev' _PKG = '@hotwired/turbo' -_VER = 'v7.0.0-beta.4-TQFv5Y2xd4hn2VnTxVul' +_VER = 'v7.0.0-beta.5-LhgiwOUjafYu3bb8VbTv' class Turbo: @@ -18,7 +18,8 @@ def __init__(self, app=None): self.init_app(app) def init_app(self, app): - ws_route = app.config.get('TURBO_WEBSOCKET_ROUTE', '/turbo-stream') + ws_route = app.config.setdefault('TURBO_WEBSOCKET_ROUTE', + '/turbo-stream') if ws_route: self.sock = Sock() @@ -58,9 +59,10 @@ def default_user_id(self): return uuid.uuid4().hex def turbo(self, version=_VER, url=None): - """Add turbo.js to the template. + """Add turbo.js to the page. - Add `{{ turbo() }}` in the `
` section of your main template. + You must add `{{ turbo() }}` in the `` section of your main + template to activate turbo.js. """ if url is None: url = f'{_CDN}/pin/{_PKG}@{version}/min/{_PKG}.js' @@ -69,7 +71,7 @@ def turbo(self, version=_VER, url=None): if ws_route: return Markup(f'''''') else: return Markup(f'')