accrete 0.0.54__py3-none-any.whl → 0.0.55__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/utils/http.py CHANGED
@@ -1,13 +1,14 @@
1
1
  import logging
2
2
  import json
3
3
  import operator
4
+ from typing import Callable
4
5
  from django.db.models import Model, Q, QuerySet
5
6
  from accrete.utils.models import get_related_model
6
7
  from accrete.annotation import Annotation
7
8
 
8
9
  _logger = logging.getLogger(__name__)
9
10
 
10
- Querystring_KEY_MAP = {
11
+ QUERYSTRING_KEY_MAP = {
11
12
  'querystring': 'q',
12
13
  'order': 'order',
13
14
  'paginate_by': 'paginate_by',
@@ -19,7 +20,7 @@ def filter_from_querystring(
19
20
  model: type[Model], get_params: dict, key_map: dict = None
20
21
  ) -> QuerySet:
21
22
 
22
- key_map = key_map or Querystring_KEY_MAP
23
+ key_map = key_map or QUERYSTRING_KEY_MAP
23
24
  querystring = get_params.get(key_map['querystring'], '[]')
24
25
  order = get_params.get(key_map['order']) or model._meta.ordering
25
26
 
@@ -96,4 +97,14 @@ def parse_querystring(model: type[Model], query_string: str) -> Q:
96
97
 
97
98
  ops = {'&': operator.and_, '|': operator.or_, '^': operator.xor}
98
99
  query = parse_query_block(query_data)
99
- return query
100
+ return query
101
+
102
+
103
+ def cast_param(params: dict, param: str, cast_to: Callable, default):
104
+ if param not in params:
105
+ return default
106
+ try:
107
+ return cast_to(params.get(param, default))
108
+ except Exception as e:
109
+ _logger.exception(e)
110
+ return default
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: accrete
3
- Version: 0.0.54
3
+ Version: 0.0.55
4
4
  Summary: Django Shared Schema Multi Tenant
5
5
  Author-email: Benedikt Jilek <benedikt.jilek@pm.me>
6
6
  License: Copyright (c) 2023 Benedikt Jilek
@@ -3,8 +3,8 @@ accrete/admin.py,sha256=MUYUmCFlGYPowiXTbwl4_Q6Cq0-neiL53WW4P76JCLs,1174
3
3
  accrete/annotation.py,sha256=P85kNgf_ka3U8i5cwaiKaAiSm21U-xY9PKmXMZR2ulU,1160
4
4
  accrete/apps.py,sha256=F7ynMLHJr_6bRujWtZVUzCliY2CGKiDvyUmL4F68L2E,146
5
5
  accrete/config.py,sha256=eJUbvyBO3DvAD6xkVKjTAzlXy7V7EK9bVyb91girfUs,299
6
- accrete/forms.py,sha256=2LobDn8EjHIaqBcgE4_Xk-nbfN6CPQasey-l22cQcT0,10740
7
- accrete/managers.py,sha256=EvWURMnGadnH3d-wXwv0-sLJKD6uGY03tSCiRSGsKbo,1170
6
+ accrete/forms.py,sha256=2vUh80qNvPDD8Zl3agKBSJEQeY7bXVLOx_SAB34wf8E,1359
7
+ accrete/managers.py,sha256=CaIJLeBry4NYIXaVUrdUjp7zx4sEWgv-1-ssI1m-EOs,1156
8
8
  accrete/middleware.py,sha256=bUsvhdVdUlbqB-Hd5Y5w6WL8rO8It1VSGA5EZaEPA3o,3266
9
9
  accrete/models.py,sha256=grvRNXg0ZYAJU3KAIX-svuZXeXlfqP4qEJ00nlbV594,5145
10
10
  accrete/tenant.py,sha256=g3ZuTrQr2zqmIopNBRQeCmHEK2R3dlUme_hOV765J6U,1778
@@ -32,12 +32,12 @@ accrete/contrib/system_mail/tests.py,sha256=mrbGGRNg5jwbTJtWWa7zSKdDyeB4vmgZCRc2
32
32
  accrete/contrib/system_mail/views.py,sha256=xc1IQHrsij7j33TUbo-_oewy3vs03pw_etpBWaMYJl0,63
33
33
  accrete/contrib/system_mail/migrations/0001_initial.py,sha256=6cwkkRXGjXvwXoMjjgmWmcPyXSTlUbhW1vMiHObk9MQ,1074
34
34
  accrete/contrib/system_mail/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
- accrete/contrib/ui/__init__.py,sha256=gnU3YLT6kHCxrUm1c-Bsvh8-hpdLGbGYxdNGcNGsXlg,477
35
+ accrete/contrib/ui/__init__.py,sha256=aeRSerct2JWpztNoxWDZXi7FzJhfxptVMVAZl4Sdzqs,504
36
36
  accrete/contrib/ui/admin.py,sha256=suMo4x8I3JBxAFBVIdE-5qnqZ6JAZV0FESABHOSc-vg,63
37
37
  accrete/contrib/ui/apps.py,sha256=E0ao2ox6PQ3ldfeR17FXJUUJuGiWjm2DPCxHbPXGzls,152
38
- accrete/contrib/ui/context.py,sha256=Nyrv9EqdadUxZVGw2Eq--Rmpc6TtqvxJGBVR3pDp6bA,7080
38
+ accrete/contrib/ui/context.py,sha256=jVD7w9QIIA2qh04UrO9rYDDrY-0Osr6FLggMlGxvztI,8364
39
39
  accrete/contrib/ui/elements.py,sha256=mxhNC-29YqkPei4bQB6fHkBuOc-mv5WWN7JiUJ_ys0o,1856
40
- accrete/contrib/ui/filter.py,sha256=PnBDVwl2iV3xBg5cphYiib5dUx-0wKHGtwS-FaBDbkA,12188
40
+ accrete/contrib/ui/filter.py,sha256=L7sBpmk454kaSZIQXe9hNj1Xbna8hJ2P-YTvmM7T5FE,12243
41
41
  accrete/contrib/ui/tests.py,sha256=mrbGGRNg5jwbTJtWWa7zSKdDyeB4vmgZCRc2nk6VY-g,60
42
42
  accrete/contrib/ui/urls.py,sha256=TUBlz_CGs9InTZoxM78GSnucA73I8knoh_obt12RUHM,186
43
43
  accrete/contrib/ui/views.py,sha256=WpBKMsxFFG8eG4IN7TW_TPE6i3OFF7gnLDTK7JMKti8,191
@@ -135,9 +135,9 @@ accrete/contrib/ui/static/bulma/versions/bulma-no-dark-mode.scss,sha256=w6Q80mCV
135
135
  accrete/contrib/ui/static/bulma/versions/bulma-no-helpers-prefixed.scss,sha256=6HCUc4hxyaj4_rHqUnoy7aMuFZECHDYh5jvp-1CEtfE,344
136
136
  accrete/contrib/ui/static/bulma/versions/bulma-no-helpers.scss,sha256=5dzAXSgReWUO8GXLbYTpOclPPD0xqvvBiCCX_GOR_5U,313
137
137
  accrete/contrib/ui/static/bulma/versions/bulma-prefixed.scss,sha256=Yj7oEO00jy_G_L32y6rwzp2P5p2YtQ2Pvq4aZhvBSE8,138
138
- accrete/contrib/ui/static/css/accrete.css,sha256=gly-wbcFOb6Hp_W3Mn1Cqs3e-0x8c1YeOVrBg79ez6I,604755
139
- accrete/contrib/ui/static/css/accrete.css.map,sha256=eo0HelugPMu2qS1b3iC6LA-gLB7b7TwqtmqMt8rYTyU,94336
140
- accrete/contrib/ui/static/css/accrete.scss,sha256=gZnT9Quqku1IZ8zVTPCNs9WJcGjm2QsIJF1QDBFowJ0,9959
138
+ accrete/contrib/ui/static/css/accrete.css,sha256=pgbEKJKk3C0KXn_Vn43V90DGSC-J3Geg-imyTNuT4jk,604948
139
+ accrete/contrib/ui/static/css/accrete.css.map,sha256=g0TsYsK_LT_sa79uPNMFbzAyiUkaPwrUTw4jrE-g0Cg,94375
140
+ accrete/contrib/ui/static/css/accrete.scss,sha256=UHa62b7J14bEoiKYAmxm1dMlnb0lnpLDXWNbKT8kxX0,10385
141
141
  accrete/contrib/ui/static/css/fa.css,sha256=wiz7ZSCn_btzhjKDQBms9Hx4sSeUYsDrTLg7roPstac,102641
142
142
  accrete/contrib/ui/static/css/icons.css,sha256=5550KHsaayeEtRaUdf0h7esQhyec-_5ZfecZ_sOC6v0,6334
143
143
  accrete/contrib/ui/static/icons/Logo.svg,sha256=hGZuxrAa-LRpFavFiF8Lnc7X9OQcqmb6Xl_dxx-27hM,1861
@@ -160,15 +160,16 @@ accrete/contrib/ui/templates/django/forms/widgets/input.html,sha256=CRu81kTsbPwi
160
160
  accrete/contrib/ui/templates/django/forms/widgets/select.html,sha256=jT_UnHizHfdWTdJoSxjcIqTiR7NbVBA4bBSvkuDPRtw,394
161
161
  accrete/contrib/ui/templates/django/forms/widgets/text.html,sha256=MSmLlQc7PsPoDLVtTOOiWNprrsPriNr712yFxaHyDIo,47
162
162
  accrete/contrib/ui/templates/django/forms/widgets/textarea.html,sha256=c9BTedqb3IkXLyVYd0p9pR8DFnsXCNGoxVBWZTk_Fic,278
163
- accrete/contrib/ui/templates/ui/detail.html,sha256=23daOnFjl1rx32zJJ7MtZtRur1Z4-KeHNrbpNPJyliU,5181
164
- accrete/contrib/ui/templates/ui/form.html,sha256=R5digymvYfefbT4QmwzMzWm41GS-JA3CZU6zDTDWr9k,915
165
- accrete/contrib/ui/templates/ui/layout.html,sha256=yZ4ItF8fXah76EltFsb_vb5RpcCPkx_4gc-RBp_ShMM,14587
163
+ accrete/contrib/ui/templates/ui/dashboard.html,sha256=udnwiSJEcn2wMaJfTs4P0Y20FU79VguK_9Lq4K2BqtM,160
164
+ accrete/contrib/ui/templates/ui/detail.html,sha256=b1HC1QCGooo6tLh7fLhEDPau1tIOzscLXP6R_PN758I,1093
165
+ accrete/contrib/ui/templates/ui/form.html,sha256=cd6VUNzfIZH2_iudQa_EkqsPaBjyTam4Fm-Kgh8YpkY,655
166
+ accrete/contrib/ui/templates/ui/layout.html,sha256=f8K0KDlh_eDz0UKH0IB34dBjPtDiNgsuPgysK-DYLgE,14792
166
167
  accrete/contrib/ui/templates/ui/list.html,sha256=6jmChhCpj6iuSqAG7X_eD5ZjVvwU4cyynmvoH0-juTk,1740
167
168
  accrete/contrib/ui/templates/ui/table.html,sha256=bdPN2F7e7i3FHcQ18e0HJKkYT64PpxPRALRjcirJKGQ,4243
168
- accrete/contrib/ui/templates/ui/partials/filter.html,sha256=ypmjni56II9s1j3PuxDutuieR7wU-NFCZlSnSfWPGc4,7212
169
- accrete/contrib/ui/templates/ui/partials/form_errors.html,sha256=1_TQvTdiejsn-43YSyp2YfnP52P-MFYb-HGY0DLm4oA,991
169
+ accrete/contrib/ui/templates/ui/partials/filter.html,sha256=2vmeL3980rMmkRnmVtZh9mBHe6S0PTMjaGIN1J6SpNM,7184
170
+ accrete/contrib/ui/templates/ui/partials/form_errors.html,sha256=QjfRriD9Z5SlhIFX__nVXqB3rPg4icbG4G02kML8IcQ,1529
170
171
  accrete/contrib/ui/templates/ui/partials/form_modal.html,sha256=TQVkLypx8y1inZbvUYKtSNHrDXJM1xvYl8IsDDwQwkE,1093
171
- accrete/contrib/ui/templates/ui/partials/header.html,sha256=8pGO-0eO44BPz12sDWq2GOfri8JOh1cMs39eramXLr8,6921
172
+ accrete/contrib/ui/templates/ui/partials/header.html,sha256=5ER9E6c-vwDxuIuMSXL4F_fq2zYY17R_0A0Ao--H4Us,6916
172
173
  accrete/contrib/ui/templates/ui/partials/onchange_form.html,sha256=K5twTGqRUW1iM2dGtdWntjsJvJVo5EIzKxX2HK-H1yw,160
173
174
  accrete/contrib/ui/templates/ui/partials/pagination_detail.html,sha256=58nA3X7Il0FAD4VcYyr7tTGWRiVf_FN1TkImmKEpKHU,1014
174
175
  accrete/contrib/ui/templates/ui/partials/pagination_list.html,sha256=Eyx1lsk9UIFFYPICL7RuYeUFaKVlmvWVXnFCGR-II7k,1324
@@ -213,12 +214,12 @@ accrete/contrib/user_registration/templates/user_registration/mail_templates/con
213
214
  accrete/migrations/0001_initial.py,sha256=azThbc8otEhxJwo8BIgOt5eC30mxXhKJLBAazZFe3BA,4166
214
215
  accrete/migrations/0002_initial.py,sha256=dFOM7kdHlx7pVAh8cTDlZMtciN4O9Z547HAzEKnygZE,1628
215
216
  accrete/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
216
- accrete/utils/__init__.py,sha256=BGXx2NwF4Sc6uaenKNvPZEmHuHVY1u97PPECrd1seA8,129
217
+ accrete/utils/__init__.py,sha256=YwEzwjz-E92LHhqeLsQ4167zXHHY1PFG6xcsAofnmBU,192
217
218
  accrete/utils/dates.py,sha256=apM6kt6JhGrKgoT0jfav1W-8AUVTxNc9xt3fJQ2n0JI,1492
218
- accrete/utils/forms.py,sha256=FHR9IP76dkULCtX4H68xbQG5uvkBQZnDEXSlHyz34iU,606
219
- accrete/utils/http.py,sha256=dR4p-Q8xoTlrjfx0sN--vkY4ZGtYUsqqquAfPNxsXx8,3249
219
+ accrete/utils/forms.py,sha256=UP6vCCTtXD5MqU2LWbNXtk2ZMMEmoty_tjLCbJlqYsY,2984
220
+ accrete/utils/http.py,sha256=mAtQRgADv7zu1_j7A-EKVyb-oqa5a21i4Gd0QfjzGV0,3540
220
221
  accrete/utils/models.py,sha256=EEhv7-sQVtQD24PEb3XcDUAh3VVhVFoMMLyFrDjGEaI,706
221
- accrete-0.0.54.dist-info/METADATA,sha256=Ko3L--FycMyXqzIrefGNJnrK_vVfvTn-LCiFo3Di-LM,4892
222
- accrete-0.0.54.dist-info/WHEEL,sha256=xl5aZkiJYVTjhVaiADvIe6UeUVylGNomrxKZ0Zda1CE,87
223
- accrete-0.0.54.dist-info/licenses/LICENSE,sha256=_7laeMIHnsd3Y2vJEXDYXq_PEXxIcjgJsGt8UIKTRWc,1057
224
- accrete-0.0.54.dist-info/RECORD,,
222
+ accrete-0.0.55.dist-info/METADATA,sha256=Ex39yLJvYLDO_BC1Y8M5RwMJ3fJvX-Ghn2SHYyLtINQ,4892
223
+ accrete-0.0.55.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
224
+ accrete-0.0.55.dist-info/licenses/LICENSE,sha256=_7laeMIHnsd3Y2vJEXDYXq_PEXxIcjgJsGt8UIKTRWc,1057
225
+ accrete-0.0.55.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.23.0
2
+ Generator: hatchling 1.25.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any