djhtmx 1.2.1__tar.gz → 1.2.3__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.
Files changed (39) hide show
  1. {djhtmx-1.2.1 → djhtmx-1.2.3}/CHANGELOG.md +18 -0
  2. {djhtmx-1.2.1 → djhtmx-1.2.3}/PKG-INFO +1 -1
  3. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/__init__.py +1 -1
  4. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/repo.py +3 -14
  5. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/static/htmx/django.js +0 -11
  6. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/templates/htmx/headers.html +0 -2
  7. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/templatetags/htmx.py +6 -1
  8. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/urls.py +2 -1
  9. {djhtmx-1.2.1 → djhtmx-1.2.3}/.gitignore +0 -0
  10. {djhtmx-1.2.1 → djhtmx-1.2.3}/LICENSE +0 -0
  11. {djhtmx-1.2.1 → djhtmx-1.2.3}/MANIFEST.in +0 -0
  12. {djhtmx-1.2.1 → djhtmx-1.2.3}/README.md +0 -0
  13. {djhtmx-1.2.1 → djhtmx-1.2.3}/pyproject.toml +0 -0
  14. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/apps.py +0 -0
  15. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/command_queue.py +0 -0
  16. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/commands.py +0 -0
  17. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/component.py +0 -0
  18. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/consumer.py +0 -0
  19. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/context.py +0 -0
  20. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/exceptions.py +0 -0
  21. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/global_events.py +0 -0
  22. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/introspection.py +0 -0
  23. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/json.py +0 -0
  24. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/management/commands/htmx.py +0 -0
  25. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/middleware.py +0 -0
  26. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/query.py +0 -0
  27. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/settings.py +0 -0
  28. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/static/htmx/2.0.4/ext/ws.js +0 -0
  29. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/static/htmx/2.0.4/htmx.amd.js +0 -0
  30. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/static/htmx/2.0.4/htmx.cjs.js +0 -0
  31. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/static/htmx/2.0.4/htmx.esm.d.ts +0 -0
  32. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/static/htmx/2.0.4/htmx.esm.js +0 -0
  33. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/static/htmx/2.0.4/htmx.js +0 -0
  34. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/static/htmx/2.0.4/htmx.min.js +0 -0
  35. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/templates/htmx/lazy.html +0 -0
  36. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/templatetags/__init__.py +0 -0
  37. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/testing.py +0 -0
  38. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/tracing.py +0 -0
  39. {djhtmx-1.2.1 → djhtmx-1.2.3}/src/djhtmx/utils.py +0 -0
@@ -7,6 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.2.3] - 2025-10-09
11
+
12
+ ### Fixed
13
+ - Fixed OOB tag to use component ID directly instead of context 'id' key for more consistent behavior
14
+
15
+ ### Changed
16
+ - Refactored context merging logic in Repository.render() for better code clarity
17
+ - Removed CSRF meta tags
18
+
19
+ ## [1.2.2] - 2025-10-06
20
+
21
+ ### Fixed
22
+ - Fixed tests related to component template names
23
+ - Removed CSRF verification on endpoint
24
+
25
+ ### Changed
26
+ - Removed redundant code-quality workflow
27
+
10
28
  ## [1.2.1] - 2025-10-01
11
29
 
12
30
  ### Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: djhtmx
3
- Version: 1.2.1
3
+ Version: 1.2.3
4
4
  Summary: Interactive UI Components for Django using HTMX
5
5
  Project-URL: Homepage, https://github.com/edelvalle/djhtmx
6
6
  Project-URL: Documentation, https://github.com/edelvalle/djhtmx#readme
@@ -1,4 +1,4 @@
1
1
  from .middleware import middleware
2
2
 
3
- __version__ = "1.2.1"
3
+ __version__ = "1.2.3"
4
4
  __all__ = ("middleware",)
@@ -438,7 +438,7 @@ class Repository:
438
438
  ):
439
439
  self.session.store(component)
440
440
 
441
- base_context = {
441
+ final_context = {
442
442
  "htmx_repo": self,
443
443
  "hx_oob": oob == "true",
444
444
  "this": component,
@@ -446,20 +446,9 @@ class Repository:
446
446
 
447
447
  if lazy:
448
448
  template = template or component._template_name_lazy
449
- base_context |= {"hx_lazy": True} | component._get_lazy_context()
449
+ final_context |= {"hx_lazy": True} | component._get_lazy_context() | (context or {})
450
450
  else:
451
- base_context |= component._get_context()
452
-
453
- # If context is provided, it should override the component context
454
- if context is not None:
455
- # Keep base_context (htmx_repo, hx_oob, this) but let provided context override everything else
456
- final_context = {
457
- "htmx_repo": self,
458
- "hx_oob": oob == "true",
459
- "this": component,
460
- } | context
461
- else:
462
- final_context = base_context
451
+ final_context |= component._get_context() if context is None else context
463
452
 
464
453
  html = mark_safe(component._get_template(template)(final_context).strip())
465
454
 
@@ -1,15 +1,4 @@
1
1
  (function () {
2
- document.body.addEventListener("htmx:configRequest", (event) => {
3
- const csrf_header = document
4
- .querySelector("meta[name=django-csrf-header-name]")
5
- .getAttribute("content");
6
- const csrf_token = document
7
- .querySelector("meta[name=django-csrf-token]")
8
- .getAttribute("content");
9
-
10
- event.detail.headers[csrf_header] = csrf_token;
11
- });
12
-
13
2
  // WebSocket Management
14
3
  let sentComponents = new Set();
15
4
 
@@ -1,8 +1,6 @@
1
1
  {% load static %}
2
2
 
3
3
  {% if enabled %}
4
- <meta name="django-csrf-header-name" content="{{ CSRF_HEADER_NAME }}" />
5
- <meta name="django-csrf-token" content="{{ csrf_token }}" />
6
4
  {% for script_url in SCRIPT_URLS %}
7
5
  <script defer src="{% static script_url %}"></script>
8
6
  {% endfor %}
@@ -138,7 +138,12 @@ def hx_tag(context: Context):
138
138
  def oob(context: Context, suffix: str):
139
139
  oob = context.get("hx_oob")
140
140
  context["hx_oob"] = False
141
- id = "-".join(filter(None, (context.get("id"), suffix)))
141
+ if (component := context.get("this")):
142
+ component_id = component.id
143
+ else:
144
+ component_id = None
145
+
146
+ id = "-".join(filter(None, (component_id, suffix)))
142
147
  return format_html_attrs({"id": id, "hx-swap-oob": "true" if oob else None})
143
148
 
144
149
 
@@ -8,6 +8,7 @@ from django.http.request import HttpRequest
8
8
  from django.http.response import HttpResponse
9
9
  from django.urls import path, re_path
10
10
  from django.utils.html import format_html
11
+ from django.views.decorators.csrf import csrf_exempt
11
12
 
12
13
  from .commands import PushURL, ReplaceURL, SendHtml
13
14
  from .component import REGISTRY, Destroy, DispatchDOMEvent, Focus, Open, Redirect, Triggers
@@ -95,7 +96,7 @@ def app_name_of_component(cls: type):
95
96
  urlpatterns = [
96
97
  path(
97
98
  f"{app_name_of_component(component)}/{component_name}/<component_id>/<event_handler>",
98
- partial(endpoint, component_name=component_name),
99
+ csrf_exempt(partial(endpoint, component_name=component_name)),
99
100
  name=f"djhtmx.{component_name}",
100
101
  )
101
102
  for component_name, component in REGISTRY.items()
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
File without changes
File without changes
File without changes