djhtmx 1.0.0__py3-none-any.whl → 1.1.0__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/command_queue.py +4 -1
- djhtmx/utils.py +8 -5
- {djhtmx-1.0.0.dist-info → djhtmx-1.1.0.dist-info}/METADATA +1 -1
- {djhtmx-1.0.0.dist-info → djhtmx-1.1.0.dist-info}/RECORD +7 -7
- {djhtmx-1.0.0.dist-info → djhtmx-1.1.0.dist-info}/WHEEL +0 -0
- {djhtmx-1.0.0.dist-info → djhtmx-1.1.0.dist-info}/licenses/LICENSE +0 -0
djhtmx/__init__.py
CHANGED
djhtmx/command_queue.py
CHANGED
|
@@ -48,7 +48,10 @@ class CommandQueue:
|
|
|
48
48
|
else:
|
|
49
49
|
action = "updated"
|
|
50
50
|
|
|
51
|
-
signals = get_model_subscriptions(
|
|
51
|
+
signals = get_model_subscriptions(
|
|
52
|
+
instance, actions=(action, None)
|
|
53
|
+
) | get_model_subscriptions(type(instance), actions=(action, None))
|
|
54
|
+
|
|
52
55
|
for field in get_related_fields(sender):
|
|
53
56
|
fk_id = getattr(instance, field.name)
|
|
54
57
|
signal = f"{field.related_model_name}.{fk_id}.{field.relation_name}"
|
djhtmx/utils.py
CHANGED
|
@@ -63,9 +63,12 @@ def get_instance_subscriptions(
|
|
|
63
63
|
return {f"{prefix}.{action}" for action in actions}
|
|
64
64
|
|
|
65
65
|
|
|
66
|
+
Action = t.Literal["created", "updated", "deleted"]
|
|
67
|
+
|
|
68
|
+
|
|
66
69
|
def get_model_subscriptions(
|
|
67
70
|
obj: type[models.Model] | models.Model,
|
|
68
|
-
actions: t.Sequence[
|
|
71
|
+
actions: t.Sequence[Action | None] = (),
|
|
69
72
|
) -> set[str]:
|
|
70
73
|
"""Get the subscriptions to actions of the model.
|
|
71
74
|
|
|
@@ -77,6 +80,7 @@ def get_model_subscriptions(
|
|
|
77
80
|
possible relation (e.g 'users.deleted').
|
|
78
81
|
|
|
79
82
|
"""
|
|
83
|
+
actions = actions or (None,)
|
|
80
84
|
if isinstance(obj, models.Model):
|
|
81
85
|
cls = type(obj)
|
|
82
86
|
instance = obj
|
|
@@ -85,10 +89,9 @@ def get_model_subscriptions(
|
|
|
85
89
|
instance = None
|
|
86
90
|
app = cls._meta.app_label
|
|
87
91
|
name = cls._meta.model_name
|
|
88
|
-
|
|
89
|
-
if instance
|
|
90
|
-
|
|
91
|
-
result.update(f"{prefix}.{action}" for action in actions)
|
|
92
|
+
model_prefix = f"{app}.{name}"
|
|
93
|
+
prefix = f"{model_prefix}.{instance.pk}" if instance else model_prefix
|
|
94
|
+
result = {(f"{prefix}.{action}" if action else prefix) for action in actions}
|
|
92
95
|
return result
|
|
93
96
|
|
|
94
97
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
djhtmx/__init__.py,sha256=
|
|
1
|
+
djhtmx/__init__.py,sha256=MiVvh3rJgbNToOeS7aUnsMLrMlP5Iay7tmb1HV1M26M,84
|
|
2
2
|
djhtmx/apps.py,sha256=_Ic52zQLpbYmyuCAlgZ0lF3NDgi77sxptb31snBAN4o,268
|
|
3
|
-
djhtmx/command_queue.py,sha256=
|
|
3
|
+
djhtmx/command_queue.py,sha256=kiYbQFPyjnhMSR7KgO1Nu-lWiapnH511P2Pyg-Zrdq4,4862
|
|
4
4
|
djhtmx/commands.py,sha256=UxXbARd4Teetjh_zjvAWgI2KNbvdETH-WrGf4qD9Xr8,1206
|
|
5
5
|
djhtmx/component.py,sha256=viqrizs85e6zlGh3Zlf2n2HxfBg1cOaSp5deVGPRGXY,15739
|
|
6
6
|
djhtmx/consumer.py,sha256=kHNoXokcWaFjs5zbZAhM7Y0x7GVwwawXbxBCkP8HNA8,2839
|
|
@@ -16,7 +16,7 @@ djhtmx/settings.py,sha256=ymFUMvrcXDkYU9KkhPOjRZSQMWz5GcUjlgh07x09-1s,1242
|
|
|
16
16
|
djhtmx/testing.py,sha256=AdZKsT6sNTsyqSKx6EmfthOIHzSAPkTquheMfg9znbk,8301
|
|
17
17
|
djhtmx/tracing.py,sha256=xkCXb7t_3yCj1PGzmQfHPu9sYQftDKwtALaEbFVnQ1E,1260
|
|
18
18
|
djhtmx/urls.py,sha256=zWMlw_udCUWvo5DNxsvbebSNRFxy0C9ghBmRg08XlcU,3894
|
|
19
|
-
djhtmx/utils.py,sha256=
|
|
19
|
+
djhtmx/utils.py,sha256=Zm8d3-PWIYz7944I_k8lstBuHaK7b8qG6C-1CvpEots,3674
|
|
20
20
|
djhtmx/management/commands/htmx.py,sha256=EtJhQofJ4Dl3s34Uihz4WbSljzy5R6r0HXGaX4vkcDg,2011
|
|
21
21
|
djhtmx/static/htmx/django.js,sha256=G59uwy5hA4QUcAFJv21SMxizATpNZG3KfgFlO2zXeGc,7086
|
|
22
22
|
djhtmx/static/htmx/2.0.4/htmx.amd.js,sha256=Hgmm_X5zw7ek0pjBaxhzH7OHx6Xfce5UYVa9ICWlWR0,165593
|
|
@@ -30,7 +30,7 @@ djhtmx/templates/htmx/headers.html,sha256=rBQTBt9rnlxE8lgxN4U7nvzQZNw4JZKS4flD1V
|
|
|
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
32
|
djhtmx/templatetags/htmx.py,sha256=HlH7_B9lJoTDoIkYPeEE55OwpBTrrCesE70j1KcRC70,8063
|
|
33
|
-
djhtmx-1.
|
|
34
|
-
djhtmx-1.
|
|
35
|
-
djhtmx-1.
|
|
36
|
-
djhtmx-1.
|
|
33
|
+
djhtmx-1.1.0.dist-info/METADATA,sha256=ctTquyqFqGicWiPXRep9JYP29ofmOfzgLq8RDKYdRlU,28298
|
|
34
|
+
djhtmx-1.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
35
|
+
djhtmx-1.1.0.dist-info/licenses/LICENSE,sha256=kCi_iSBUGsRZInQn96w7LXYzjiRjZ8FXl6vP--mFRPk,1085
|
|
36
|
+
djhtmx-1.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|