turbo_response.shortcuts#

Module Contents#

Functions#

redirect_303(to, *args, **kwargs)

Obsolete: Sends an HTTP 303 redirect.

render_form_response(request, form, template[, ...])

Returns a TemplateResponse with the correct status if the form contains errors.

turbo_response.shortcuts.redirect_303(to, *args, **kwargs)#

Obsolete: Sends an HTTP 303 redirect.

Parameters:

to (Union[str, django.db.models.Model]) – URL or view name or model instance. If model then calls get_absolute_url().

Return type:

turbo_response.response.HttpResponseSeeOther

turbo_response.shortcuts.render_form_response(request, form, template, context=None, *, turbo_stream_template=None, turbo_stream_target=None, turbo_stream_action=Action.REPLACE, **response_kwargs)#

Returns a TemplateResponse with the correct status if the form contains errors.

If turbo_stream_template is provided along with turbo_stream_target, a TurboStream response will be returned instead if there are form validation errors.

Parameters:
  • request (django.http.HttpRequest) –

  • form (django.forms.Form) –

  • template (Union[str, List[str]]) –

  • context (Optional[Dict]) –

  • turbo_stream_template (Optional[Union[str, List[str]]]) –

  • turbo_stream_target (Optional[str]) –

  • turbo_stream_action (turbo_response.constants.Action) –

Return type:

django.template.response.TemplateResponse