plain.htmx 0.12.0__tar.gz → 0.13.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/PKG-INFO +1 -1
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/CHANGELOG.md +11 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/views.py +15 -15
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/pyproject.toml +1 -1
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/tests/test_views.py +2 -3
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/.gitignore +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/LICENSE +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/README.md +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/deps.yml +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/package-lock.json +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/package.json +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/README.md +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/__init__.py +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/plainhtmx.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/idiomorph/idiomorph-ext.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/idiomorph/idiomorph-ext.min.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/idiomorph/idiomorph-htmx.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/idiomorph/idiomorph.amd.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/idiomorph/idiomorph.cjs.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/idiomorph/idiomorph.esm.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/idiomorph/idiomorph.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/idiomorph/idiomorph.min.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/README.md +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/ajax-header.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/alpine-morph.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/class-tools.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/client-side-templates.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/debug.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/disable-element.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/event-header.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/head-support.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/include-vals.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/json-enc.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/loading-states.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/method-override.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/morphdom-swap.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/multi-swap.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/path-deps.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/path-params.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/preload.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/rails-method.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/remove-me.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/response-targets.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/restored.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/sse.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/ws.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/htmx.amd.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/htmx.cjs.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/htmx.esm.d.ts +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/htmx.esm.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/htmx.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/htmx.min.js +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/htmx.min.js.gz +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/templates/htmx/js.html +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/templates.py +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/tests/app/settings.py +0 -0
- {plain_htmx-0.12.0 → plain_htmx-0.13.0}/tests/app/urls.py +0 -0
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# plain-htmx changelog
|
|
2
2
|
|
|
3
|
+
## [0.13.0](https://github.com/dropseed/plain/releases/plain-htmx@0.13.0) (2025-11-24)
|
|
4
|
+
|
|
5
|
+
### What's changed
|
|
6
|
+
|
|
7
|
+
- Replaced `HTMXViewMixin` with `HTMXView` class that inherits from `TemplateView` for better type checking support ([569afd6](https://github.com/dropseed/plain/commit/569afd6))
|
|
8
|
+
|
|
9
|
+
### Upgrade instructions
|
|
10
|
+
|
|
11
|
+
- Replace `class MyView(HTMXViewMixin, TemplateView)` with `class MyView(HTMXView)` - the new `HTMXView` class already inherits from `TemplateView`
|
|
12
|
+
- Update imports from `from plain.htmx.views import HTMXViewMixin` to `from plain.htmx.views import HTMXView`
|
|
13
|
+
|
|
3
14
|
## [0.12.0](https://github.com/dropseed/plain/releases/plain-htmx@0.12.0) (2025-11-12)
|
|
4
15
|
|
|
5
16
|
### What's changed
|
|
@@ -3,19 +3,19 @@ from __future__ import annotations
|
|
|
3
3
|
from collections.abc import Callable
|
|
4
4
|
from typing import Any
|
|
5
5
|
|
|
6
|
-
from plain.http import
|
|
6
|
+
from plain.http import ResponseBase
|
|
7
7
|
from plain.utils.cache import patch_vary_headers
|
|
8
|
+
from plain.views import TemplateView
|
|
8
9
|
|
|
9
10
|
from .templates import render_template_fragment
|
|
10
11
|
|
|
11
12
|
|
|
12
|
-
class
|
|
13
|
-
"""
|
|
13
|
+
class HTMXView(TemplateView):
|
|
14
|
+
"""View with HTMX-specific functionality."""
|
|
14
15
|
|
|
15
16
|
def render_template(self) -> str:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
context = self.get_template_context() # type: ignore[attr-defined]
|
|
17
|
+
template = self.get_template()
|
|
18
|
+
context = self.get_template_context()
|
|
19
19
|
|
|
20
20
|
if self.is_htmx_request() and self.get_htmx_fragment_name():
|
|
21
21
|
return render_template_fragment(
|
|
@@ -26,8 +26,8 @@ class HTMXViewMixin:
|
|
|
26
26
|
|
|
27
27
|
return template.render(context)
|
|
28
28
|
|
|
29
|
-
def get_response(self) ->
|
|
30
|
-
response = super().get_response()
|
|
29
|
+
def get_response(self) -> ResponseBase:
|
|
30
|
+
response = super().get_response()
|
|
31
31
|
# Tell browser caching to also consider the fragment header,
|
|
32
32
|
# not just the url/cookie.
|
|
33
33
|
patch_vary_headers(
|
|
@@ -35,11 +35,11 @@ class HTMXViewMixin:
|
|
|
35
35
|
)
|
|
36
36
|
return response
|
|
37
37
|
|
|
38
|
-
def get_request_handler(self) -> Callable[
|
|
39
|
-
if self.is_htmx_request():
|
|
38
|
+
def get_request_handler(self) -> Callable[[], Any] | None:
|
|
39
|
+
if self.is_htmx_request() and self.request.method:
|
|
40
40
|
# You can use an htmx_{method} method on views
|
|
41
41
|
# (or htmx_{method}_{action} for specific actions)
|
|
42
|
-
method = f"htmx_{self.request.method.lower()}"
|
|
42
|
+
method = f"htmx_{self.request.method.lower()}"
|
|
43
43
|
|
|
44
44
|
if action := self.get_htmx_action_name():
|
|
45
45
|
# If an action is specified, we throw an error if
|
|
@@ -52,14 +52,14 @@ class HTMXViewMixin:
|
|
|
52
52
|
# to a regular post method if it's not found
|
|
53
53
|
return handler
|
|
54
54
|
|
|
55
|
-
return super().get_request_handler()
|
|
55
|
+
return super().get_request_handler()
|
|
56
56
|
|
|
57
57
|
def is_htmx_request(self) -> bool:
|
|
58
|
-
return self.request.headers.get("HX-Request") == "true"
|
|
58
|
+
return self.request.headers.get("HX-Request") == "true"
|
|
59
59
|
|
|
60
60
|
def get_htmx_fragment_name(self) -> str:
|
|
61
61
|
# A custom header that we pass with the {% htmxfragment %} tag
|
|
62
|
-
return self.request.headers.get("Plain-HX-Fragment", "")
|
|
62
|
+
return self.request.headers.get("Plain-HX-Fragment", "")
|
|
63
63
|
|
|
64
64
|
def get_htmx_action_name(self) -> str:
|
|
65
|
-
return self.request.headers.get("Plain-HX-Action", "")
|
|
65
|
+
return self.request.headers.get("Plain-HX-Action", "")
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
from plain.htmx.views import
|
|
1
|
+
from plain.htmx.views import HTMXView
|
|
2
2
|
from plain.http import Response
|
|
3
3
|
from plain.test import RequestFactory
|
|
4
|
-
from plain.views import View
|
|
5
4
|
|
|
6
5
|
|
|
7
|
-
class V(
|
|
6
|
+
class V(HTMXView):
|
|
8
7
|
def get(self):
|
|
9
8
|
return Response("Ok")
|
|
10
9
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/idiomorph/idiomorph-ext.js
RENAMED
|
File without changes
|
{plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/idiomorph/idiomorph-ext.min.js
RENAMED
|
File without changes
|
{plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/idiomorph/idiomorph-htmx.js
RENAMED
|
File without changes
|
{plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/idiomorph/idiomorph.amd.js
RENAMED
|
File without changes
|
{plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/idiomorph/idiomorph.cjs.js
RENAMED
|
File without changes
|
{plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/idiomorph/idiomorph.esm.js
RENAMED
|
File without changes
|
{plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/idiomorph/idiomorph.js
RENAMED
|
File without changes
|
{plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/idiomorph/idiomorph.min.js
RENAMED
|
File without changes
|
|
File without changes
|
{plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/ajax-header.js
RENAMED
|
File without changes
|
{plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/alpine-morph.js
RENAMED
|
File without changes
|
{plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/class-tools.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/disable-element.js
RENAMED
|
File without changes
|
{plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/event-header.js
RENAMED
|
File without changes
|
{plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/head-support.js
RENAMED
|
File without changes
|
{plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/include-vals.js
RENAMED
|
File without changes
|
|
File without changes
|
{plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/loading-states.js
RENAMED
|
File without changes
|
{plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/method-override.js
RENAMED
|
File without changes
|
{plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/morphdom-swap.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/path-params.js
RENAMED
|
File without changes
|
|
File without changes
|
{plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/rails-method.js
RENAMED
|
File without changes
|
|
File without changes
|
{plain_htmx-0.12.0 → plain_htmx-0.13.0}/plain/htmx/assets/htmx/vendor/src/ext/response-targets.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|