accrete 0.0.75__py3-none-any.whl → 0.0.77__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.
@@ -2,6 +2,7 @@ import logging
2
2
  import json
3
3
  from urllib.parse import quote_plus
4
4
  from dataclasses import dataclass, field
5
+ from functools import partial
5
6
  from typing import Type, TypedDict, Callable
6
7
  from django.utils.translation import gettext_lazy as _t
7
8
  from django.db import models
@@ -30,12 +31,12 @@ class DetailPagination(TypedDict):
30
31
 
31
32
 
32
33
  @dataclass(kw_only=True)
33
- class KwargsContext:
34
+ class BaseContext:
34
35
 
35
- kwargs: dict = field(default_factory=dict)
36
+ extra: dict = field(default_factory=dict)
36
37
 
37
38
  def __post_init__(self):
38
- for key, value in self.kwargs.items():
39
+ for key, value in self.extra.items():
39
40
  setattr(self, key, value)
40
41
 
41
42
  def dict(self):
@@ -46,7 +47,7 @@ class KwargsContext:
46
47
 
47
48
 
48
49
  @dataclass(kw_only=True)
49
- class Context(KwargsContext):
50
+ class Context(BaseContext):
50
51
 
51
52
  title: str = ''
52
53
  breadcrumbs: list[BreadCrumb] = field(default_factory=list)
@@ -81,7 +82,7 @@ def table_context_factory(model: Type[Model], params: dict, queryset=None, **kwa
81
82
  except exceptions.FieldDoesNotExist:
82
83
  has_name_field = False
83
84
 
84
- ctx = TableContext(
85
+ ctx = partial(TableContext, **dict(
85
86
  title=str(model._meta.verbose_name_plural),
86
87
  object_label=str(model._meta.verbose_name),
87
88
  object_param_str=url_param_str(
@@ -99,10 +100,9 @@ def table_context_factory(model: Type[Model], params: dict, queryset=None, **kwa
99
100
  filter=Filter(
100
101
  model,
101
102
  default_filter_term='name__icontains' if has_name_field else ''
102
- ),
103
- **kwargs
104
- )
105
- return ctx
103
+ )
104
+ ))
105
+ return ctx(**kwargs)
106
106
 
107
107
 
108
108
  @dataclass
@@ -115,6 +115,8 @@ class ListContext(Context):
115
115
  filter: Filter = None
116
116
  endless_scroll: bool = True
117
117
  column_width: int = 12
118
+ column_width_widescreen: int = None
119
+ column_width_desktop: int = None
118
120
  column_height: int = 150
119
121
  column_height_unit: str = 'px'
120
122
  field_selection: bool = False
@@ -125,6 +127,10 @@ class ListContext(Context):
125
127
  _logger.warning(
126
128
  'ListContext parameter column_width should be in range 1 - 12'
127
129
  )
130
+ if self.column_width_widescreen is None:
131
+ self.column_width_widescreen = self.column_width
132
+ if self.column_width_desktop is None:
133
+ self.column_width_desktop = self.column_width
128
134
 
129
135
 
130
136
  def list_context_factory(model: Type[Model], params: dict, queryset=None, paginate_by=None, **kwargs) -> ListContext:
@@ -142,7 +148,7 @@ def list_context_factory(model: Type[Model], params: dict, queryset=None, pagina
142
148
  except exceptions.FieldDoesNotExist:
143
149
  has_name_field = False
144
150
 
145
- ctx = ListContext(
151
+ ctx = partial(ListContext, **dict(
146
152
  title=str(model._meta.verbose_name_plural),
147
153
  object_label=str(model._meta.verbose_name),
148
154
  object_param_str=url_param_str(
@@ -159,10 +165,9 @@ def list_context_factory(model: Type[Model], params: dict, queryset=None, pagina
159
165
  default_filter_term='name__icontains' if has_name_field else ''
160
166
  ),
161
167
  column_width=4,
162
- column_height=150,
163
- **kwargs
164
- )
165
- return ctx
168
+ column_height=150
169
+ ))
170
+ return ctx(**kwargs)
166
171
 
167
172
 
168
173
  @dataclass
@@ -183,7 +188,7 @@ class FormContext(Context):
183
188
 
184
189
 
185
190
  @dataclass
186
- class ModalFormContext(KwargsContext):
191
+ class ModalFormContext(BaseContext):
187
192
 
188
193
  title: str
189
194
  form: Form | ModelForm
@@ -16,6 +16,7 @@ class Icon(Enum):
16
16
  DELETE_FILTER = 'icon-delete-filter'
17
17
  SELECT = 'icon-select'
18
18
  TRASH_CAN = 'fa fa-trash-can'
19
+ BOLT = 'fa fa-bolt'
19
20
 
20
21
 
21
22
  class ActionMethod(Enum):
@@ -7,7 +7,7 @@
7
7
  {% block content %}
8
8
  <div class="columns is-multiline">
9
9
  {% for obj in list_page %}
10
- <div class="list-column column is-{{ column_width }}-fullhd is-12-touch is-12-desktop is-12-widescreen"
10
+ <div class="list-column column is-{{ column_width }}-fullhd is-{{ column_width_widescreen }}-widescreen is-{{ column_width_desktop }}-desktop is-12-touch"
11
11
  style="height: {{ column_height }}{{ column_height_unit }}"
12
12
  {% if endless_scroll and forloop.last and list_page.has_next %}
13
13
  hx-get="{{ pagination_param_str }}&page={{ list_page.next_page_number }}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: accrete
3
- Version: 0.0.75
3
+ Version: 0.0.77
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
@@ -37,8 +37,8 @@ accrete/contrib/system_mail/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JC
37
37
  accrete/contrib/ui/__init__.py,sha256=jU-3gQtEwtac-NPxFYCEoYF58WmCEanedXah4lETkWU,552
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=kOJivwk_uvJWPijjErCZNizDrfb1WEK04M_kfb-0dM0,9769
41
- accrete/contrib/ui/elements.py,sha256=IhK1WuhbJzV-Pvr0OVMkKrKpYYrl2knuvGimYECONfI,1917
40
+ accrete/contrib/ui/context.py,sha256=HZNKf_O71FxbH4kYXw-wUVQmUTkmCB19i6VyJL0FF3Q,10100
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
44
44
  accrete/contrib/ui/urls.py,sha256=UrRRroqP6ANW_jpkRWqo2yLvBhYOVhczzbxbfkGnoq4,124
@@ -166,7 +166,7 @@ accrete/contrib/ui/templates/ui/dashboard.html,sha256=udnwiSJEcn2wMaJfTs4P0Y20FU
166
166
  accrete/contrib/ui/templates/ui/detail.html,sha256=-Nksyufbf4onufqmFGTAW_BxLRNSWv1A9n8Qs2a6aCo,564
167
167
  accrete/contrib/ui/templates/ui/form.html,sha256=uCtP16THdOuRfs3JdsjadIW0k9b2rN3GAsRSTfSUWak,691
168
168
  accrete/contrib/ui/templates/ui/layout.html,sha256=abdGekzMYI4twq_cRFTKEnttb-QmNWrI9oQPrbnbqCQ,15688
169
- accrete/contrib/ui/templates/ui/list.html,sha256=pgrnv9PDwIZ_oSpWxqMRdVaWXiGEJyNCFgdMb2BoKmg,1442
169
+ accrete/contrib/ui/templates/ui/list.html,sha256=FTODO-uwRY4lPkzDDf_Adgn7Ck7PMBm8F6J_ao72HFQ,1493
170
170
  accrete/contrib/ui/templates/ui/table.html,sha256=8ELtgxoapCyNsvmGISAGXe712lG6AkP_nekb4OVLK3I,4481
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
@@ -221,7 +221,7 @@ accrete/utils/dates.py,sha256=apM6kt6JhGrKgoT0jfav1W-8AUVTxNc9xt3fJQ2n0JI,1492
221
221
  accrete/utils/forms.py,sha256=Lll-DvAhKZDw72XeuCtb4wxQEJNFp7lQWh_Z1GyH3Zk,3049
222
222
  accrete/utils/http.py,sha256=mAtQRgADv7zu1_j7A-EKVyb-oqa5a21i4Gd0QfjzGV0,3540
223
223
  accrete/utils/models.py,sha256=EEhv7-sQVtQD24PEb3XcDUAh3VVhVFoMMLyFrDjGEaI,706
224
- accrete-0.0.75.dist-info/METADATA,sha256=Beuc15e3mBqM_oSNp-FURZv6U7DU8vmfK0uuFFoPBPE,4892
225
- accrete-0.0.75.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
226
- accrete-0.0.75.dist-info/licenses/LICENSE,sha256=_7laeMIHnsd3Y2vJEXDYXq_PEXxIcjgJsGt8UIKTRWc,1057
227
- accrete-0.0.75.dist-info/RECORD,,
224
+ accrete-0.0.77.dist-info/METADATA,sha256=5WK5qeJEnQ6axXO7JkKbCbSWpyURJ5kTfoLkVE_72M0,4892
225
+ accrete-0.0.77.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
226
+ accrete-0.0.77.dist-info/licenses/LICENSE,sha256=_7laeMIHnsd3Y2vJEXDYXq_PEXxIcjgJsGt8UIKTRWc,1057
227
+ accrete-0.0.77.dist-info/RECORD,,