turbo_helper¶

Submodules¶

Attributes¶

Classes¶

Functions¶

get_current_request()

redirect_303(to, *args, **kwargs)

Sends an HTTP 303 redirect.

respond_to(request)

Inspired by Rails

after_create_commit(sender)

after_delete_commit(sender)

after_update_commit(sender)

register_turbo_stream_action(name)

Package Contents¶

turbo_helper.get_current_request()¶
class turbo_helper.HttpResponseSeeOther¶

Bases: django.http.HttpResponseRedirect

status_code¶
class turbo_helper.TurboStreamResponse(*args, **kwargs)¶

Bases: django.http.HttpResponse

turbo_helper.redirect_303(to, *args, **kwargs)¶

Sends an HTTP 303 redirect.

All arguments are forwarded to django.shortcuts.resolve_url to generate the redirect URL.

https://github.com/django/django/blob/9c436a09b3a641874881706495ae07293aa97c2f/django/shortcuts.py#L151

Parameters:

to (Union[str, django.db.models.Model])

Return type:

turbo_helper.response.HttpResponseSeeOther

turbo_helper.respond_to(request)¶

Inspired by Rails

https://www.writesoftwarewell.com/how-respond_to-method-works-rails/

respond_to do |format|

format.turbo_stream { render turbo_stream: turbo_stream_template }

end

turbo_helper.after_create_commit(sender)¶
turbo_helper.after_delete_commit(sender)¶
turbo_helper.after_update_commit(sender)¶
turbo_helper.register_turbo_stream_action(name)¶
turbo_helper.turbo_stream¶