djhtmx 1.2.2__py3-none-any.whl → 1.2.3__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 CHANGED
@@ -1,4 +1,4 @@
1
1
  from .middleware import middleware
2
2
 
3
- __version__ = "1.2.2"
3
+ __version__ = "1.2.3"
4
4
  __all__ = ("middleware",)
djhtmx/repo.py CHANGED
@@ -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,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
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: djhtmx
3
- Version: 1.2.2
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
- djhtmx/__init__.py,sha256=l25O4H6NDgkxXNhFUfB5NRdVr6ewp4P6sM4cDCO4YXE,84
1
+ djhtmx/__init__.py,sha256=hbGM57sddqXSUuq33t8onRR9gAZHabW9HMdpyZVjtRA,84
2
2
  djhtmx/apps.py,sha256=hAyjzmInEstxLY9k8Qn58LvNlezgQLx5_NqyVL1WwYs,323
3
3
  djhtmx/command_queue.py,sha256=kiYbQFPyjnhMSR7KgO1Nu-lWiapnH511P2Pyg-Zrdq4,4862
4
4
  djhtmx/commands.py,sha256=UxXbARd4Teetjh_zjvAWgI2KNbvdETH-WrGf4qD9Xr8,1206
@@ -11,7 +11,7 @@ djhtmx/introspection.py,sha256=flVolO6xZiXsxMm876ZCEcWRmVfFsJWpAVmIdfcJNf8,13734
11
11
  djhtmx/json.py,sha256=7cjwWIJj7e0dk54INKYZJe6zKkIW7wlsNSlD05cbXfY,1374
12
12
  djhtmx/middleware.py,sha256=JuMtv9ZnpungTvQ1qD2Lg6LiFPB3knQlA1ERgH4iGl0,1274
13
13
  djhtmx/query.py,sha256=UyjN1jokh4wTwQJxcRwA9f-Zn-A7A4GLToeGrCnPhKA,6674
14
- djhtmx/repo.py,sha256=KYYhZWomrKB512QBjjb2ThaUWbmq6SZsYvcrl3Z5nGY,22797
14
+ djhtmx/repo.py,sha256=SpJK6KpxK9MraN29RvShaFt3ksifBAkv_gHUrxVkzIQ,22374
15
15
  djhtmx/settings.py,sha256=ymFUMvrcXDkYU9KkhPOjRZSQMWz5GcUjlgh07x09-1s,1242
16
16
  djhtmx/testing.py,sha256=AdZKsT6sNTsyqSKx6EmfthOIHzSAPkTquheMfg9znbk,8301
17
17
  djhtmx/tracing.py,sha256=xkCXb7t_3yCj1PGzmQfHPu9sYQftDKwtALaEbFVnQ1E,1260
@@ -26,11 +26,11 @@ djhtmx/static/htmx/2.0.4/htmx.esm.js,sha256=tHolTyBDgr3AbbT_ajWo1dGJCArqvxKRu55r
26
26
  djhtmx/static/htmx/2.0.4/htmx.js,sha256=ywqZv5HDa9054MnUZ3xXnoIC-aWNtfDFnJAIXqDkEnU,165563
27
27
  djhtmx/static/htmx/2.0.4/htmx.min.js,sha256=4gndpcgjVHnzFm3vx3UOHbzVpcGAi3eS_C5nM3aPtEc,50917
28
28
  djhtmx/static/htmx/2.0.4/ext/ws.js,sha256=HwUYFqEZBvs7Tx0_O0Bi-Dcmg5UOMlbMdkJ2FWeVpDA,14609
29
- djhtmx/templates/htmx/headers.html,sha256=rBQTBt9rnlxE8lgxN4U7nvzQZNw4JZKS4flD1VXeMx8,297
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=HlH7_B9lJoTDoIkYPeEE55OwpBTrrCesE70j1KcRC70,8063
33
- djhtmx-1.2.2.dist-info/METADATA,sha256=b4XSwBq9PCYhdREgZbH49y7R3WhpoEr2LYroDp5FtAY,32245
34
- djhtmx-1.2.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
35
- djhtmx-1.2.2.dist-info/licenses/LICENSE,sha256=kCi_iSBUGsRZInQn96w7LXYzjiRjZ8FXl6vP--mFRPk,1085
36
- djhtmx-1.2.2.dist-info/RECORD,,
32
+ djhtmx/templatetags/htmx.py,sha256=p9y9hZ2mAq7F-9lXTY4pMmOdML7jNOwGwf-eRNdDv4g,8176
33
+ djhtmx-1.2.3.dist-info/METADATA,sha256=i95CIpDVornagEsXtxmri90a86BoT3ywUFcByzNcnhc,32245
34
+ djhtmx-1.2.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
35
+ djhtmx-1.2.3.dist-info/licenses/LICENSE,sha256=kCi_iSBUGsRZInQn96w7LXYzjiRjZ8FXl6vP--mFRPk,1085
36
+ djhtmx-1.2.3.dist-info/RECORD,,
File without changes