accrete 0.0.42__py3-none-any.whl → 0.0.44__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.
@@ -1,5 +1,6 @@
1
1
  from .filter import Filter
2
2
  from .context import (
3
+ Context,
3
4
  DetailContext,
4
5
  TableContext,
5
6
  ListContext,
@@ -1,7 +1,7 @@
1
1
  import logging
2
2
  from urllib.parse import quote_plus
3
3
  from dataclasses import dataclass, field
4
- from typing import TypedDict
4
+ from typing import TypedDict, Callable
5
5
  from django.utils.translation import gettext_lazy as _t
6
6
  from django.db import models
7
7
  from django.db.models import Model, QuerySet
@@ -80,26 +80,22 @@ class ListContext(Context):
80
80
  )
81
81
 
82
82
 
83
- class DetailContext(TypedDict, total=False):
83
+ @dataclass
84
+ class DetailContext(Context):
84
85
 
85
- title: str
86
86
  object: Model
87
- breadcrumbs: list[BreadCrumb]
88
- detail_page: DetailPagination
89
- pagination_param_str: str
90
- actions: list[ClientAction]
87
+ detail_page: DetailPagination = None
88
+ pagination_param_str: str = ''
91
89
 
92
90
 
93
- class FormContext(TypedDict, total=False):
91
+ @dataclass
92
+ class FormContext(Context):
94
93
 
95
- title: str
96
- breadcrumbs: list[BreadCrumb]
97
94
  form: Form | ModelForm
98
95
  form_id: str
99
- actions: list[ClientAction]
100
96
 
101
97
 
102
- def cast_param(params: dict, param: str, cast_to: callable, default):
98
+ def cast_param(params: dict, param: str, cast_to: Callable, default):
103
99
  if param not in params:
104
100
  return default
105
101
  try:
@@ -110,7 +106,10 @@ def cast_param(params: dict, param: str, cast_to: callable, default):
110
106
 
111
107
 
112
108
  def url_param_dict(get_params: dict) -> dict:
113
- return {key: f'&{key}={quote_plus(value)}' for key, value in get_params.items()}
109
+ return {
110
+ key: f'&{key}={quote_plus(value)}'
111
+ for key, value in get_params.items()
112
+ }
114
113
 
115
114
 
116
115
  def url_param_str(params: dict, extract: list[str] = None) -> str:
@@ -138,9 +137,13 @@ def exclude_params(params: dict, keys: list[str]) -> dict:
138
137
  return {key: val for key, val in params.items() if key not in keys}
139
138
 
140
139
 
141
- def list_page(queryset: QuerySet, paginate_by: int, page_number: int) -> paginator.Page:
140
+ def list_page(
141
+ queryset: QuerySet, paginate_by: int, page_number: int
142
+ ) -> paginator.Page:
142
143
  pages = Paginator(queryset, per_page=paginate_by)
143
- return pages.page(page_number <= pages.num_pages and page_number or pages.num_pages)
144
+ return pages.page(
145
+ page_number <= pages.num_pages and page_number or pages.num_pages
146
+ )
144
147
 
145
148
 
146
149
  def detail_page(queryset: QuerySet, obj: Model) -> dict:
@@ -24,7 +24,7 @@ def combine_templates(template_name, request=None):
24
24
  )
25
25
  except template.TemplateDoesNotExist:
26
26
  continue
27
- cache.set(template_name, html, 60 * 15)
27
+ cache.set(template_name, html, None)
28
28
  return mark_safe(html)
29
29
 
30
30
 
@@ -6,8 +6,6 @@
6
6
  <a class="navbar-item" href="/admin/">Admin</a>
7
7
  {% endif %}
8
8
  <hr class="navbar-divider">
9
- <form id="logout-form" method="post" action="{% url 'user:logout' %}">
10
- {% csrf_token %}
11
- <a class="navbar-item" href="#" onclick="document.getElementById('logout-form').submit()">{% translate "Log out" %}</a>
12
- </form>
9
+ <a class="navbar-item" hx-post="{% url 'user:logout' %}">{% translate "Log out" %}</a>
10
+
13
11
 
@@ -45,7 +45,7 @@ def user_detail(request):
45
45
  ui.ClientAction(_('Change E-Mail'), url=reverse('user:edit_email')),
46
46
  ui.ClientAction(_('Change Password'), url=reverse('user:edit_password'))
47
47
  ]
48
- )
48
+ ).dict()
49
49
  return render(request, 'user/user_detail.html', ctx)
50
50
 
51
51
 
@@ -64,7 +64,7 @@ def user_edit(request):
64
64
  form=form,
65
65
  form_id='form',
66
66
  actions=ui.form_actions(reverse('user:detail'))
67
- )
67
+ ).dict()
68
68
  return render(request, 'user/user_form.html', ctx)
69
69
 
70
70
 
@@ -86,7 +86,7 @@ def user_change_password(request):
86
86
  form=form,
87
87
  form_id='form',
88
88
  actions=ui.form_actions(reverse('user:detail'))
89
- )
89
+ ).dict()
90
90
  return render(request, 'user/change_password.html', ctx)
91
91
 
92
92
 
@@ -108,5 +108,5 @@ def user_change_email(request):
108
108
  form=form,
109
109
  form_id='form',
110
110
  actions=ui.form_actions(reverse('user:detail'))
111
- )
111
+ ).dict()
112
112
  return render(request, 'user/change_email.html', ctx)
@@ -1,27 +1,27 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: accrete
3
- Version: 0.0.42
3
+ Version: 0.0.44
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
7
-
8
- Permission is hereby granted, free of charge, to any person obtaining a copy
9
- of this software and associated documentation files (the "Software"), to deal
10
- in the Software without restriction, including without limitation the rights
11
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- copies of the Software, and to permit persons to whom the Software is
13
- furnished to do so, subject to the following conditions:
14
-
15
- The above copyright notice and this permission notice shall be included in all
16
- copies or substantial portions of the Software.
17
-
18
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
- SOFTWARE.
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in all
16
+ copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ SOFTWARE.
25
25
  License-File: LICENSE
26
26
  Classifier: Environment :: Web Environment
27
27
  Classifier: Framework :: Django
@@ -32,10 +32,10 @@ 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=B_SJ3S9v4CQLNnQKqnWRGhddq6M5gn3vEg4KKuaKGPA,441
35
+ accrete/contrib/ui/__init__.py,sha256=4R1ys-Q9Ia_KNEzhjacewcRhWuU2i3BYmG2CW33QyJU,454
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=wNx5D7B-3maa2bdVQlqdHDjl3MQ2Y-YGcXPX0z3o_NY,6902
38
+ accrete/contrib/ui/context.py,sha256=uGDJe_ZlUgkFcngooIkius52PUNqMNZh2pNe8OvPNY8,6800
39
39
  accrete/contrib/ui/elements.py,sha256=yUziI8uQt4Uzg2MUx1KZQQSrmJXXdeSAaYwOp292J5A,1639
40
40
  accrete/contrib/ui/filter.py,sha256=PnBDVwl2iV3xBg5cphYiib5dUx-0wKHGtwS-FaBDbkA,12188
41
41
  accrete/contrib/ui/tests.py,sha256=mrbGGRNg5jwbTJtWWa7zSKdDyeB4vmgZCRc2nk6VY-g,60
@@ -150,7 +150,7 @@ accrete/contrib/ui/templates/ui/partials/table_field_float.html,sha256=GH_jFdpk8
150
150
  accrete/contrib/ui/templates/ui/partials/table_field_monetary.html,sha256=Wtod9vel2dD4vG8lUVLbtls4aU_2EG3p0E1QRRUSH10,166
151
151
  accrete/contrib/ui/templates/ui/partials/table_field_string.html,sha256=GH_jFdpk8wEJXv4QfO6c3URYrZGGLeuSyWwWl2cWxwQ,45
152
152
  accrete/contrib/ui/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
153
- accrete/contrib/ui/templatetags/accrete_ui.py,sha256=B0Gt-kA7U6rBqEmTvCtxFFe_OaiCuZQSaBf1Ksdk4OI,2539
153
+ accrete/contrib/ui/templatetags/accrete_ui.py,sha256=Quu2Qr8m1OM7tZ_YlYGw6cTjSI5m5B8Qb2nm8tjGhQE,2536
154
154
  accrete/contrib/user/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
155
155
  accrete/contrib/user/admin.py,sha256=YS4iApli7XUaIl9GsEJxys2j8sepX0by88omYHjff-E,85
156
156
  accrete/contrib/user/apps.py,sha256=oHDrAiHf-G57mZLyxqGJzRY2DbPprGFD-QgyVJG_ruI,156
@@ -159,12 +159,12 @@ accrete/contrib/user/middleware.py,sha256=qblcujwJsthopagyT-hPFq4HsMyGt-VvqZw5TQ
159
159
  accrete/contrib/user/models.py,sha256=SFEXG9G-XY7Nuss7DT51abDv8BWLHKYJocOhQDI_1Lw,3926
160
160
  accrete/contrib/user/tests.py,sha256=mrbGGRNg5jwbTJtWWa7zSKdDyeB4vmgZCRc2nk6VY-g,60
161
161
  accrete/contrib/user/urls.py,sha256=ktQJ3vZxDlKNUfzOxReeDLOduSdoW5z5Sz0LVFpxZGU,460
162
- accrete/contrib/user/views.py,sha256=oNY6HrZpUyCn0NmCRcA93JDwO64dA910F8INkvTo4Hk,3611
162
+ accrete/contrib/user/views.py,sha256=k_XmmsltJHoPY86VHJskdLTwMKJh7IyGd0gDGEPPOOM,3639
163
163
  accrete/contrib/user/locale/de/LC_MESSAGES/django.mo,sha256=p3rgUg6WltAVIMkQsjvjBqTsd_usLhSr1GH4Cyltc2c,433
164
164
  accrete/contrib/user/locale/de/LC_MESSAGES/django.po,sha256=f_Nxpo3HTm2L3f3zoHLfeWsZ-4IQp_EEVSku6TCZSvw,1870
165
165
  accrete/contrib/user/migrations/0001_initial.py,sha256=JWfM9PcMDfkJUdCjLWuWieGs6643qP0KdbCyr5uAZoY,2950
166
166
  accrete/contrib/user/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
167
- accrete/contrib/user/templates/user/accrete_navbar_end_dropdown.html,sha256=vDFjrOZ95doOpdGYSCRlP8H-FfKUWpkYgYP8mOKcboY,481
167
+ accrete/contrib/user/templates/user/accrete_navbar_end_dropdown.html,sha256=5jlz8GBCRTuQWQ9ZsflZ2N4-AJ3X4IyZFpuS-c6bbgM,349
168
168
  accrete/contrib/user/templates/user/change_email.html,sha256=i9ZgDH31awO9W87E6c3_MKgQNf1ff7EYQX1nEdPqRC8,995
169
169
  accrete/contrib/user/templates/user/change_password.html,sha256=wcwm5_tfPgs9V7VWdDQqhhyMpcIkiGsx2OIptF5fWMk,1498
170
170
  accrete/contrib/user/templates/user/login.html,sha256=TuEH4uKK1CFV5X7nP3xPSzu2VJaoEn6APsHh-k6GiCc,1388
@@ -191,7 +191,7 @@ accrete/utils/dates.py,sha256=apM6kt6JhGrKgoT0jfav1W-8AUVTxNc9xt3fJQ2n0JI,1492
191
191
  accrete/utils/forms.py,sha256=FHR9IP76dkULCtX4H68xbQG5uvkBQZnDEXSlHyz34iU,606
192
192
  accrete/utils/http.py,sha256=dR4p-Q8xoTlrjfx0sN--vkY4ZGtYUsqqquAfPNxsXx8,3249
193
193
  accrete/utils/models.py,sha256=EEhv7-sQVtQD24PEb3XcDUAh3VVhVFoMMLyFrDjGEaI,706
194
- accrete-0.0.42.dist-info/METADATA,sha256=vkMQ6I_GiUCxiIITKzxPN5gMDCvRymDPWrdmrgdRJWo,4892
195
- accrete-0.0.42.dist-info/WHEEL,sha256=TJPnKdtrSue7xZ_AVGkp9YXcvDrobsjBds1du3Nx6dc,87
196
- accrete-0.0.42.dist-info/licenses/LICENSE,sha256=_7laeMIHnsd3Y2vJEXDYXq_PEXxIcjgJsGt8UIKTRWc,1057
197
- accrete-0.0.42.dist-info/RECORD,,
194
+ accrete-0.0.44.dist-info/METADATA,sha256=4nKf_OgAai-p4uhRXhuQi9M7ogG8w024uYRTvWARvXI,5036
195
+ accrete-0.0.44.dist-info/WHEEL,sha256=BLLCEE40Rfjo8jwRub1wGKjUkeOWfyP-q5USh3YvGoA,87
196
+ accrete-0.0.44.dist-info/licenses/LICENSE,sha256=_7laeMIHnsd3Y2vJEXDYXq_PEXxIcjgJsGt8UIKTRWc,1057
197
+ accrete-0.0.44.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.21.1
2
+ Generator: hatchling 1.22.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any