accrete 0.0.77__py3-none-any.whl → 0.0.79__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.
- accrete/contrib/ui/__init__.py +1 -0
- accrete/contrib/ui/context.py +14 -0
- accrete/contrib/ui/templates/ui/partials/modal.html +34 -0
- accrete/contrib/ui/templates/ui/partials/modal_form.html +5 -3
- accrete/models.py +2 -2
- {accrete-0.0.77.dist-info → accrete-0.0.79.dist-info}/METADATA +1 -1
- {accrete-0.0.77.dist-info → accrete-0.0.79.dist-info}/RECORD +9 -8
- {accrete-0.0.77.dist-info → accrete-0.0.79.dist-info}/WHEEL +0 -0
- {accrete-0.0.77.dist-info → accrete-0.0.79.dist-info}/licenses/LICENSE +0 -0
accrete/contrib/ui/__init__.py
CHANGED
accrete/contrib/ui/context.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import logging
|
2
2
|
import json
|
3
3
|
from urllib.parse import quote_plus
|
4
|
+
from uuid import uuid4
|
4
5
|
from dataclasses import dataclass, field
|
5
6
|
from functools import partial
|
6
7
|
from typing import Type, TypedDict, Callable
|
@@ -196,6 +197,19 @@ class ModalFormContext(BaseContext):
|
|
196
197
|
blocking: bool = True
|
197
198
|
|
198
199
|
|
200
|
+
@dataclass
|
201
|
+
class ModalContext(BaseContext):
|
202
|
+
|
203
|
+
title: str
|
204
|
+
blocking: bool = False
|
205
|
+
modal_id: str = None
|
206
|
+
|
207
|
+
def __post_init__(self):
|
208
|
+
super().__post_init__()
|
209
|
+
if not self.modal_id:
|
210
|
+
self.modal_id = f'modal{str(uuid4())[:8]}'
|
211
|
+
|
212
|
+
|
199
213
|
def cast_param(params: dict, param: str, cast_to: Callable, default):
|
200
214
|
if param not in params:
|
201
215
|
return default
|
@@ -0,0 +1,34 @@
|
|
1
|
+
{% load i18n %}
|
2
|
+
|
3
|
+
<div x-data="" x-ref="modal" class="modal is-active"
|
4
|
+
{% if blocking %}
|
5
|
+
hx-indicator="#{{ modal_id }}-indicator"
|
6
|
+
hx-disabled-elt="#{{ modal_id }}-background"
|
7
|
+
{% endif %}
|
8
|
+
>
|
9
|
+
<button id="{{ modal_id }}-background" class="modal-background" @click="$refs.modal.remove()" style="cursor: default"></button>
|
10
|
+
<div class="modal-card">
|
11
|
+
<header class="modal-card-head">
|
12
|
+
<p class="modal-card-title">
|
13
|
+
{{ title }}
|
14
|
+
</p>
|
15
|
+
<button class="delete filter-modal-close" aria-label="close" @click="$refs.modal.remove()"></button>
|
16
|
+
</header>
|
17
|
+
<section class="modal-card-body">
|
18
|
+
{% block modal_content %}{% endblock %}
|
19
|
+
</section>
|
20
|
+
<footer class="modal-card-foot">
|
21
|
+
{% block modal_footer %}
|
22
|
+
<div class="buttons" style="width: 100%">
|
23
|
+
{% block modal_buttons %}
|
24
|
+
{% endblock %}
|
25
|
+
</div>
|
26
|
+
{% endblock %}
|
27
|
+
</footer>
|
28
|
+
{% if blocking %}
|
29
|
+
<div id="{{ modal_id }}-indicator" class="htmx-indicator modal-request-overlay" style="position: absolute; inset: 0; background: rgba(47, 47, 62, 0.2)">
|
30
|
+
<progress class="progress is-success" max="100" style="position: absolute; inset: 0; width: 50%; margin-top: 25%; margin-left: 25%"></progress>
|
31
|
+
</div>
|
32
|
+
{% endif %}
|
33
|
+
</div>
|
34
|
+
</div>
|
@@ -36,8 +36,10 @@
|
|
36
36
|
</div>
|
37
37
|
{% endblock %}
|
38
38
|
</footer>
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
{% if blocking %}
|
40
|
+
<div id="modal-{{ form_id }}-indicator" class="htmx-indicator modal-request-overlay" style="position: absolute; inset: 0; background: rgba(47, 47, 62, 0.2)">
|
41
|
+
<progress class="progress is-success" max="100" style="position: absolute; inset: 0; width: 50%; margin-top: 25%; margin-left: 25%"></progress>
|
42
|
+
</div>
|
43
|
+
{% endif %}
|
42
44
|
</div>
|
43
45
|
</div>
|
accrete/models.py
CHANGED
@@ -25,9 +25,9 @@ class TenantModel(models.Model, AnnotationModelMixin):
|
|
25
25
|
):
|
26
26
|
|
27
27
|
tenant = get_tenant()
|
28
|
-
if tenant is not None and self.tenant != tenant:
|
28
|
+
if self.pk and tenant is not None and self.tenant != tenant:
|
29
29
|
raise ValueError('Current tenant differs from tenant of the record!')
|
30
|
-
self.tenant =
|
30
|
+
self.tenant = tenant
|
31
31
|
super().save(
|
32
32
|
force_insert=force_insert,
|
33
33
|
force_update=force_update,
|
@@ -6,7 +6,7 @@ accrete/config.py,sha256=eJUbvyBO3DvAD6xkVKjTAzlXy7V7EK9bVyb91girfUs,299
|
|
6
6
|
accrete/forms.py,sha256=2vUh80qNvPDD8Zl3agKBSJEQeY7bXVLOx_SAB34wf8E,1359
|
7
7
|
accrete/managers.py,sha256=CaIJLeBry4NYIXaVUrdUjp7zx4sEWgv-1-ssI1m-EOs,1156
|
8
8
|
accrete/middleware.py,sha256=IABs2pAV-kXjp3n5_Wsc7reXGjU5FhmCbvFB8cC4ZRM,3422
|
9
|
-
accrete/models.py,sha256=
|
9
|
+
accrete/models.py,sha256=fiTeM7oaKz38u9egTRtWuexMhzcKhqKbaIFh6A6Jz3w,5142
|
10
10
|
accrete/storage.py,sha256=z7pHdQFw0hFGrrbfqIh7KFxabQ_JGqoPebmiX9TLmeU,1254
|
11
11
|
accrete/tenant.py,sha256=g3ZuTrQr2zqmIopNBRQeCmHEK2R3dlUme_hOV765J6U,1778
|
12
12
|
accrete/tests.py,sha256=Agltbzwwh5htvq_Qi9vqvxutzmg_GwgPS_N19xJZRlw,7197
|
@@ -34,10 +34,10 @@ accrete/contrib/system_mail/tests.py,sha256=mrbGGRNg5jwbTJtWWa7zSKdDyeB4vmgZCRc2
|
|
34
34
|
accrete/contrib/system_mail/views.py,sha256=xc1IQHrsij7j33TUbo-_oewy3vs03pw_etpBWaMYJl0,63
|
35
35
|
accrete/contrib/system_mail/migrations/0001_initial.py,sha256=6cwkkRXGjXvwXoMjjgmWmcPyXSTlUbhW1vMiHObk9MQ,1074
|
36
36
|
accrete/contrib/system_mail/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
37
|
-
accrete/contrib/ui/__init__.py,sha256=
|
37
|
+
accrete/contrib/ui/__init__.py,sha256=RiJ8hNHSpkVfT_fpwP_3XXnNo9q5E-7G59xMC6PsrWE,570
|
38
38
|
accrete/contrib/ui/admin.py,sha256=suMo4x8I3JBxAFBVIdE-5qnqZ6JAZV0FESABHOSc-vg,63
|
39
39
|
accrete/contrib/ui/apps.py,sha256=E0ao2ox6PQ3ldfeR17FXJUUJuGiWjm2DPCxHbPXGzls,152
|
40
|
-
accrete/contrib/ui/context.py,sha256=
|
40
|
+
accrete/contrib/ui/context.py,sha256=qoGYYxkC1RTw3eCf3l-CJV7NUnNTn5-DDV46ObzocH8,10384
|
41
41
|
accrete/contrib/ui/elements.py,sha256=rwXhRitKt70-ZT4yiLXvB7cp8jQbr02L7JpYwUy5jv4,1941
|
42
42
|
accrete/contrib/ui/filter.py,sha256=UAIkUNKu2nVQLafwZlkQu4PDfOPyFM61e_mE7OWRhYs,12410
|
43
43
|
accrete/contrib/ui/tests.py,sha256=mrbGGRNg5jwbTJtWWa7zSKdDyeB4vmgZCRc2nk6VY-g,60
|
@@ -171,7 +171,8 @@ accrete/contrib/ui/templates/ui/table.html,sha256=8ELtgxoapCyNsvmGISAGXe712lG6Ak
|
|
171
171
|
accrete/contrib/ui/templates/ui/partials/filter.html,sha256=2vmeL3980rMmkRnmVtZh9mBHe6S0PTMjaGIN1J6SpNM,7184
|
172
172
|
accrete/contrib/ui/templates/ui/partials/form_errors.html,sha256=C5ktasYff2xBTiWfM6QR8qaGKSyK9QufB3B9N77KGpg,1386
|
173
173
|
accrete/contrib/ui/templates/ui/partials/header.html,sha256=F-ffQGuqmL4ahhjW_tj9rCgrtqi1L-_KLRCs1ASmb90,6993
|
174
|
-
accrete/contrib/ui/templates/ui/partials/
|
174
|
+
accrete/contrib/ui/templates/ui/partials/modal.html,sha256=0vfR0LSfvOo2oOFSGeJyLkmjpXbYV1tpAcvdkyHQGyQ,1438
|
175
|
+
accrete/contrib/ui/templates/ui/partials/modal_form.html,sha256=5P1n4ykVYvIYOO84VRwoOPR_jqXakmH51i8WyeMm-QQ,2103
|
175
176
|
accrete/contrib/ui/templates/ui/partials/onchange_form.html,sha256=8wNgZYnpa6ttc-OraOi1i02isJCcnaMtYwsmObc3qcY,109
|
176
177
|
accrete/contrib/ui/templates/ui/partials/pagination_detail.html,sha256=58nA3X7Il0FAD4VcYyr7tTGWRiVf_FN1TkImmKEpKHU,1014
|
177
178
|
accrete/contrib/ui/templates/ui/partials/pagination_list.html,sha256=Eyx1lsk9UIFFYPICL7RuYeUFaKVlmvWVXnFCGR-II7k,1324
|
@@ -221,7 +222,7 @@ accrete/utils/dates.py,sha256=apM6kt6JhGrKgoT0jfav1W-8AUVTxNc9xt3fJQ2n0JI,1492
|
|
221
222
|
accrete/utils/forms.py,sha256=Lll-DvAhKZDw72XeuCtb4wxQEJNFp7lQWh_Z1GyH3Zk,3049
|
222
223
|
accrete/utils/http.py,sha256=mAtQRgADv7zu1_j7A-EKVyb-oqa5a21i4Gd0QfjzGV0,3540
|
223
224
|
accrete/utils/models.py,sha256=EEhv7-sQVtQD24PEb3XcDUAh3VVhVFoMMLyFrDjGEaI,706
|
224
|
-
accrete-0.0.
|
225
|
-
accrete-0.0.
|
226
|
-
accrete-0.0.
|
227
|
-
accrete-0.0.
|
225
|
+
accrete-0.0.79.dist-info/METADATA,sha256=fv0cU9skKtwsZhPP5OZpbiYUvHKv__C3J4TsHAPVJ1A,4892
|
226
|
+
accrete-0.0.79.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
227
|
+
accrete-0.0.79.dist-info/licenses/LICENSE,sha256=_7laeMIHnsd3Y2vJEXDYXq_PEXxIcjgJsGt8UIKTRWc,1057
|
228
|
+
accrete-0.0.79.dist-info/RECORD,,
|
File without changes
|
File without changes
|