Skip to main content

Hotwired/Turbo response helpers for Django

Project description

This package provides helpers for server-side rendering of Hotwired/Turbo streams and frames.

Disclaimer: the Hotwired/Turbo client libraries are, at time of writing, still in Beta. We expect there will be breaking changes until the first stable release. This package, and the Turbo client, should therefore be used with caution in a production environment. The version used in testing is @hotwired/turbo==7.0.0-beta.4.

Requirements

This library requires Python 3.8+ and Django 3.0+.

Installation

pip install django-turbo-response

To install from Git:

git clone https://github.com/hotwire-django/django-turbo-response

cd django-turbo-response

python setup.py install

Make sure to add turbo_response to INSTALLED_APPS.

Note: This library does not include any client libraries (Turbo or Stimulus). You may wish to add these yourself using your preferred Javascript build tool, or use a CDN. Please refer to the Hotwire documentation on installing these libraries.

Full documentation on ReadTheDocs:

https://django-turbo-response.readthedocs.io/en/latest/

License

This project is covered by the MIT license.

Changelog

[0.0.47] - 2021-4-4

Removing support for Python 3.7

[0.0.46] - 2021-4-2

Remove tests dir from distribution

[0.0.45] - 2021-4-2

Refactor renderers and remove dependency on form widget renderer classes

[0.0.44] - 2021-4-2

Allow renderer as arg for all stream and frame mixins/classes

[0.0.40] - 2021-4-2

Use file-based templates for rendering streams/frames

[0.0.39] - 2021-4-2

Fix for https://github.com/hotwire-django/django-turbo-response/issues/5

[0.0.36] - 2021-3-30

render_form_response adds turbo_stream_template name to context

turbo_stream_response decorator

[0.0.35] - 2021-2-17

render_form_response can optionally re-render form as turbo stream

[0.0.34] - 2021-2-13

Tidy up argument parsing in API

[0.0.33] - 2021-2-4

Mixin TurboFormAdapterMixin added

[0.0.32] - 2021-2-2

Refactoring modules

[0.0.31] - 2021-2-2

Refactoring mixin classes

[0.0.30] - 2021-2-1

TurboStreamIterableResponse removed

TurboStreamFormMixin and turbo-stream form views added

[0.0.29] - 2021-1-27

TurboStreamIterableResponse deprecated

TurboStreamMiddleware removed

[0.0.28] - 2021-1-22

Support for Python 3.7

[0.0.27] - 2021-1-21

Bugfix for Turbo-Frame header in middleware

[0.0.26] - 2021-1-17

Added TurboMiddleware (replacing TurboStreamMiddleware).

Removed TemplateFormResponse.

[0.0.24] - 2021-1-17

Added render_form_response shortcut.

[0.0.23] - 2021-1-14

Added TurboStreamIterableResponse class.

[0.0.22] - 2021-1-14

Added TemplateFormResponse class which automatically sets correct status based on form error state.

[0.0.21] - 2021-1-13

Middleware now accepts content type *text/vnd.turbo-stream.html.

[0.0.20] - 2021-1-13

Deprecated mixin methods removed.

Update response content type from text/html; turbo-stream to text/vnd.turbo-stream.html:

https://github.com/hotwired/turbo/releases/tag/v7.0.0-beta.3

[0.0.19] - 2021-1-13

Changes to mixin APIs.

[0.0.18] - 2021-1-12

TurboStreamDeleteView automatically resolves target based on model name+PK.

[0.0.17] - 2021-1-7

Added HttpResponseSeeOther class and redirect_303 shortcut function.

[0.0.16] - 2021-1-7

Ensure all form mixins/views return a 303 on redirect as per Turbo docs.

[0.0.15] - 2021-1-7

Removed protocol classes and mypy pre-commit requirement

[0.0.14] - 2021-1-6

Dependency bugfix

[0.0.13] - 2021-1-6

Added type hinting, tidy up of mixin class inheritance.

[0.0.12] - 2021-1-5

Update form handling for changes in @hotwired/turbo 7.0.0-beta.2:

  • TurboStreamFormMixin class and supporting classes removed
  • TurboFormMixin class added that just returns a 422 response on invalid
  • TurboStreamFormView, TurboStreamCreateView and TurboStreamUpdateView classes removed
  • TurboFormView, TurboCreateView and TurboUpdateView classes added, using new TurboFormMixin

[0.0.10] - 2020-12-30

Remove str methods from TurboStream and TurboFrame classes

[0.0.9] - 2020-12-30

Add render() method to template proxies

[0.0.8] - 2020-12-30

Added

TurboStream and TurboFrame classes

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-turbo-response-0.0.47.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_turbo_response-0.0.47-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file django-turbo-response-0.0.47.tar.gz.

File metadata

  • Download URL: django-turbo-response-0.0.47.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for django-turbo-response-0.0.47.tar.gz
Algorithm Hash digest
SHA256 31103d12bb9495338dc4d7d2a45482d3e070b52aba413fe9352dfb0d26867179
MD5 cae35a1d17cd43b0a758641cd20493f0
BLAKE2b-256 025b5bd4459f68a0ff691ef5a7f41454704d656e57a7355cea45385fc964d49a

See more details on using hashes here.

File details

Details for the file django_turbo_response-0.0.47-py3-none-any.whl.

File metadata

  • Download URL: django_turbo_response-0.0.47-py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for django_turbo_response-0.0.47-py3-none-any.whl
Algorithm Hash digest
SHA256 035f76dfb745373ded665edebabbd252117936d3132d6638e128909d6627f7b2
MD5 a4857551fb3d374e9335ef9c51f168ab
BLAKE2b-256 4aaa8d97b22d698464660fcdcc68322f9a3da933251382b5f08fb87ef916da45

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page