djhtmx 1.2.6__py3-none-any.whl → 1.2.7__py3-none-any.whl
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.
- djhtmx/__init__.py +1 -1
- djhtmx/templatetags/htmx.py +7 -3
- {djhtmx-1.2.6.dist-info → djhtmx-1.2.7.dist-info}/METADATA +1 -1
- {djhtmx-1.2.6.dist-info → djhtmx-1.2.7.dist-info}/RECORD +6 -6
- {djhtmx-1.2.6.dist-info → djhtmx-1.2.7.dist-info}/WHEEL +0 -0
- {djhtmx-1.2.6.dist-info → djhtmx-1.2.7.dist-info}/licenses/LICENSE +0 -0
djhtmx/__init__.py
CHANGED
djhtmx/templatetags/htmx.py
CHANGED
|
@@ -73,7 +73,7 @@ def add_delay_jitter(event, arg=None):
|
|
|
73
73
|
@register.simple_tag(takes_context=True)
|
|
74
74
|
def htmx(
|
|
75
75
|
context,
|
|
76
|
-
_name: str,
|
|
76
|
+
_name: str | type[HtmxComponent],
|
|
77
77
|
_state: dict[str, Any] | None = None,
|
|
78
78
|
*,
|
|
79
79
|
lazy: Literal["once"] | bool = False,
|
|
@@ -81,12 +81,16 @@ def htmx(
|
|
|
81
81
|
):
|
|
82
82
|
"""Inserts an HTMX Component.
|
|
83
83
|
|
|
84
|
-
Pass the component name and the initial state:
|
|
84
|
+
Pass the component name (as a string) or component type, and the initial state:
|
|
85
85
|
|
|
86
86
|
```html
|
|
87
87
|
{% htmx 'AmazinData' data=some_data %}
|
|
88
|
+
{% htmx MyComponent data=some_data %}
|
|
88
89
|
```
|
|
89
90
|
"""
|
|
91
|
+
# Extract component name if a type is passed
|
|
92
|
+
component_name = _name.__name__ if isinstance(_name, type) else _name
|
|
93
|
+
|
|
90
94
|
state = (_state or {}) | state
|
|
91
95
|
repo: Repository = context["htmx_repo"]
|
|
92
96
|
state |= {"lazy": lazy is True}
|
|
@@ -94,7 +98,7 @@ def htmx(
|
|
|
94
98
|
# Extract parent component ID from context if available
|
|
95
99
|
parent_id = getattr(context.get("this"), "id", None)
|
|
96
100
|
|
|
97
|
-
component = repo.build(
|
|
101
|
+
component = repo.build(component_name, state, parent_id=parent_id)
|
|
98
102
|
return repo.render_html(
|
|
99
103
|
component,
|
|
100
104
|
lazy=lazy if isinstance(lazy, bool) else False,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
djhtmx/__init__.py,sha256=
|
|
1
|
+
djhtmx/__init__.py,sha256=lggPY1vL1w3aXlDiCSKNZqUXFilPRS7UpSKfv3nQAaA,84
|
|
2
2
|
djhtmx/apps.py,sha256=hAyjzmInEstxLY9k8Qn58LvNlezgQLx5_NqyVL1WwYs,323
|
|
3
3
|
djhtmx/command_queue.py,sha256=n1TERk9RmVT4dycmCroAOMLx_KXJ-HiqIA3qs_ptG7U,4884
|
|
4
4
|
djhtmx/commands.py,sha256=UxXbARd4Teetjh_zjvAWgI2KNbvdETH-WrGf4qD9Xr8,1206
|
|
@@ -29,8 +29,8 @@ djhtmx/static/htmx/2.0.4/ext/ws.js,sha256=HwUYFqEZBvs7Tx0_O0Bi-Dcmg5UOMlbMdkJ2FW
|
|
|
29
29
|
djhtmx/templates/htmx/headers.html,sha256=z7r9klwBDXDyjbHrzatZeHDvXB2DaZhgu55CFbbD3d4,159
|
|
30
30
|
djhtmx/templates/htmx/lazy.html,sha256=LfAThtKmFj-lCUZ7JWF_sC1Y6XsIpEz8A3IgWASn-J8,52
|
|
31
31
|
djhtmx/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
32
|
-
djhtmx/templatetags/htmx.py,sha256
|
|
33
|
-
djhtmx-1.2.
|
|
34
|
-
djhtmx-1.2.
|
|
35
|
-
djhtmx-1.2.
|
|
36
|
-
djhtmx-1.2.
|
|
32
|
+
djhtmx/templatetags/htmx.py,sha256=-qFqz4T9mCJocG9XIIey81cCYwk07XUd_DMpxNdmbsM,8397
|
|
33
|
+
djhtmx-1.2.7.dist-info/METADATA,sha256=lq4p5zwNpWYNMdqwpKTPInlCZ1JXGhGUcrnZM4vniWQ,32245
|
|
34
|
+
djhtmx-1.2.7.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
35
|
+
djhtmx-1.2.7.dist-info/licenses/LICENSE,sha256=kCi_iSBUGsRZInQn96w7LXYzjiRjZ8FXl6vP--mFRPk,1085
|
|
36
|
+
djhtmx-1.2.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|