accrete 0.0.10__py3-none-any.whl → 0.0.11__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.
@@ -11,6 +11,8 @@ from accrete.contrib.ui.filter import Filter
11
11
 
12
12
  _logger = logging.getLogger(__name__)
13
13
 
14
+ DEFAULT_PAGINATE_BY = 40
15
+
14
16
 
15
17
  @dataclass
16
18
  class ClientAction:
@@ -49,13 +51,13 @@ class ListContext:
49
51
  extra_query: Q = None
50
52
  related_fields: list[str] = field(default_factory=list)
51
53
  prefetch_fields: list[str] = field(default_factory=list)
52
- paginate_by: int = 20
54
+ paginate_by: int = DEFAULT_PAGINATE_BY
53
55
  order_by: list[str] = None
54
56
  column_width: int = 12
55
57
  filter_relation_depth: int = 4
56
58
  actions: list[ClientAction] = field(default_factory=list)
57
59
  breadcrumbs: list[BreadCrumb] = field(default_factory=list)
58
- obj_label: str = 'Name'
60
+ obj_label: str = None
59
61
  fields: list[TableField] = field(default_factory=list)
60
62
 
61
63
  def get_queryset(self):
@@ -112,7 +114,7 @@ class ListContext:
112
114
  'breadcrumbs': self.breadcrumbs,
113
115
  'querystring': build_querystring(self.get_params),
114
116
  'actions': self.actions,
115
- 'obj_label': self.obj_label,
117
+ 'obj_label': self.obj_label or _('Name'),
116
118
  'fields': self.fields
117
119
  }
118
120
  context.update(self.context)
@@ -125,7 +127,7 @@ class DetailContext:
125
127
  obj: Model
126
128
  get_params: dict
127
129
  order_by: str = None
128
- paginate_by: int = 20
130
+ paginate_by: int = DEFAULT_PAGINATE_BY
129
131
  title: str = None
130
132
  queryset: type[QuerySet] = None
131
133
  extra_query: Q = None
@@ -205,7 +207,7 @@ class DetailContext:
205
207
  @dataclass
206
208
  class FormContext:
207
209
 
208
- model: Model|type[Model]
210
+ model: Model | type[Model]
209
211
  get_params: dict
210
212
  title: str = None
211
213
  context: dict = field(default_factory=dict)
@@ -225,12 +227,11 @@ class FormContext:
225
227
  ]
226
228
  try:
227
229
  url = self.discard_url or self.model.get_absolute_url()
228
- except TypeError as e:
229
- _logger.exception(
230
+ except TypeError:
231
+ raise TypeError(
230
232
  'Supply the discard_url parameter if FormContext is called '
231
233
  'with a model class instead of an instance.'
232
234
  )
233
- raise e
234
235
  except AttributeError as e:
235
236
  _logger.error(
236
237
  'Supply the discard_url parameter if FormContext is '
@@ -275,6 +276,8 @@ def build_querystring(get_params: dict, extra_params: list[str] = None) -> str:
275
276
  querystring = f'?q={get_params.get("q", "[]")}'
276
277
  if paginate_by := get_params.get('paginate_by', False):
277
278
  querystring += f'&paginate_by={paginate_by}'
279
+ # if page := get_params.get('page', False):
280
+ # querystring += f'&page={page}'
278
281
  if order_by := get_params.get('order_by', False):
279
282
  querystring += f'&order_by={order_by}'
280
283
  for param in extra_params or []:
@@ -149,3 +149,9 @@ select:focus {
149
149
  .label.is-required {
150
150
  font-weight: 700;
151
151
  }
152
+
153
+ @media screen and (max-width: 768px) {
154
+ .label.has-field {
155
+ padding: 12px 0 12px 0;
156
+ }
157
+ }
@@ -112,7 +112,7 @@
112
112
  </div>
113
113
 
114
114
  <div class="column" style="overflow-x: auto">
115
- <div class="is-flex is-flex-direction-column" style="height: 100%">
115
+ <div class="is-flex is-flex-direction-column" style="height: 100%; overflow: hidden">
116
116
  <div>
117
117
  {% include 'ui/partials/header.html' %}
118
118
  </div>
@@ -120,7 +120,19 @@
120
120
  {% block messages %}{% endblock %}
121
121
  {% block content %}{% endblock %}
122
122
  </div>
123
- <div style="height: 0"></div>
123
+ <div>
124
+ {% if list_pagination or detail_pagination %}
125
+ <div class="level is-hidden-tablet is-align-self-flex-start m-3">
126
+ <div class="level-item is-align-content-flex-start">
127
+ {% if list_pagination %}
128
+ {% include 'ui/partials/pagination_list.html' %}
129
+ {% elif detail_pagination %}
130
+ {% include 'ui/partials/pagination_detail.html' %}
131
+ {% endif %}
132
+ </div>
133
+ </div>
134
+ {% endif %}
135
+ </div>
124
136
  </div>
125
137
  </div>
126
138
  </div>
@@ -1,17 +1,6 @@
1
1
  {% load i18n %}
2
2
 
3
3
  <div class="pt-3">
4
- {% if list_pagination or detail_pagination %}
5
- <div class="level is-hidden-tablet is-align-self-flex-start mb-3 px-3">
6
- <div class="level-item is-align-content-flex-start">
7
- {% if list_pagination %}
8
- {% include 'ui/partials/pagination_list.html' %}
9
- {% elif detail_pagination %}
10
- {% include 'ui/partials/pagination_detail.html' %}
11
- {% endif %}
12
- </div>
13
- </div>
14
- {% endif %}
15
4
  <div class="level level-is-shrinkable is-flex mb-2 pl-3 {% if detail_pagination %}is-mobile {% endif %}">
16
5
  <div class="level-left">
17
6
  <div class="level-item has-text-weight-bold">
@@ -39,7 +28,7 @@
39
28
  </div>
40
29
 
41
30
  <div class="is-flex is-hidden-fullhd is-justify-content-space-between mb-2">
42
- <div class="is-flex py-1 pr-1 pl-3" style="overflow-x: auto">
31
+ <div class="is-flex py-1 px-1 ml-2" style="overflow-x: auto">
43
32
  {% for action in actions %}
44
33
  {% if action.submit %}
45
34
  <input class="button mr-2 {{ action.class_list|join:' ' }}"
@@ -61,4 +50,4 @@
61
50
  </div>
62
51
  {% endif %}
63
52
  </div>
64
- </div>
53
+ </div>
@@ -3,24 +3,20 @@
3
3
  <button class="button"
4
4
  hx-get="{{ previous_object_url }}{{ querystring }}"
5
5
  hx-replace-url="true"
6
- hx-select-oob="#content,#detail-pagination"
6
+ hx-select-oob="#content,#detail-pagination,#panel-actions"
7
7
  ><
8
8
  </button>
9
9
 
10
10
  </p>
11
- {% if total_objects > 99999 %}
12
- <p class="control is-expanded">
13
- <button class="button is-fullwidth px-1"><span class="is-size-7">{{ current_object_idx }}<br>/{{ total_objects }}</span></button>
14
- </p>
15
- {% else %}
16
- <p class="control is-expanded">
17
- <button class="button is-fullwidth px-1">{{ current_object_idx }} / {{ total_objects }}</button>
18
- </p>
19
- {% endif %}
11
+ <p class="control is-expanded">
12
+ <button class="button is-fullwidth px-1" style="white-space: normal">
13
+ <span class="{% if total_objects > 99999 %}is-size-7{% endif %}">{{ current_object_idx }} / {{ total_objects }}</span>
14
+ </button>
15
+ </p>
20
16
  <p class="control">
21
17
  <button class="button" hx-get="{{ next_object_url }}{{ querystring }}"
22
18
  hx-replace-url="true"
23
- hx-select-oob="#content,#detail-pagination"
19
+ hx-select-oob="#content,#detail-pagination,#panel-actions"
24
20
  >>
25
21
  </button>
26
22
  </p>
@@ -4,25 +4,23 @@
4
4
  <button class="button"
5
5
  hx-get="{{ querystring }}&page={% if page.has_previous %}{{ page.previous_page_number }}{% else %}{{ paginator.num_pages }}{% endif %}"
6
6
  hx-replace-url="true"
7
- hx-select-oob="#content,#list-pagination"
7
+ hx-select-oob="#content,#list-pagination,#panel-actions"
8
8
  >
9
9
  <
10
10
  </button>
11
11
  </p>
12
12
  <p class="control is-expanded">
13
- {% if paginator.count > 9999 %}
14
- <button class="button is-fullwidth px-0">
15
- <span class="is-size-7">{{ page.start_index }}-{{ page.end_index }}<br>/{{ paginator.count }}</span>
16
- </button>
17
- {% else %}
18
- <button class="button is-fullwidth">{{ page.start_index }}-{{ page.end_index }}/{{ paginator.count }}</button>
19
- {% endif %}
13
+ <button class="button is-fullwidth px-1" style="white-space: normal">
14
+ <span class="{% if paginator.count > 9999 %}is-size-7{% endif %}">
15
+ {{ page.start_index }}-{{ page.end_index }} / {{ paginator.count }}
16
+ </span>
17
+ </button>
20
18
  </p>
21
19
  <p class="control">
22
20
  <button class="button"
23
21
  hx-get="{{ querystring }}&page={% if page.has_next %}{{ page.next_page_number }}{% else %}1{% endif %}"
24
22
  hx-replace-url="true"
25
- hx-select-oob="#content,#list-pagination"
23
+ hx-select-oob="#content,#list-pagination,#panel-actions"
26
24
  >
27
25
  >
28
26
  </button>
@@ -27,7 +27,7 @@
27
27
  {% block table_data_row %}
28
28
  <tr>
29
29
  {% block table_data %}
30
- <td><a class="is-underlined" href="{{ obj.get_absolute_url }}{{ querystring }}">{{ obj }}</a></td>
30
+ <td><a class="is-underlined" href="{{ obj.get_absolute_url }}{{ querystring }}&page={{ page.number }}">{{ obj }}</a></td>
31
31
  {% for field in fields %}
32
32
  <td>{{ obj|get_attr:field.name|default_if_none:'---' }}</td>
33
33
  {% endfor %}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: accrete
3
- Version: 0.0.10
3
+ Version: 0.0.11
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
@@ -36,12 +36,12 @@ accrete/contrib/ui/__init__.py,sha256=b0Aq41co9EVKRKKrsRyhHQsUHCqtbaeI90slAxSLgK
36
36
  accrete/contrib/ui/admin.py,sha256=suMo4x8I3JBxAFBVIdE-5qnqZ6JAZV0FESABHOSc-vg,63
37
37
  accrete/contrib/ui/apps.py,sha256=E0ao2ox6PQ3ldfeR17FXJUUJuGiWjm2DPCxHbPXGzls,152
38
38
  accrete/contrib/ui/filter.py,sha256=xTziJ7ySfbpwtaWAusJSkNUtaZbEeX9UKES2AKIuAak,11897
39
- accrete/contrib/ui/helper.py,sha256=lmHcBQ4L-jtVyBuR3NH4EJRYYuK511KmkbpGxHXXByA,13100
39
+ accrete/contrib/ui/helper.py,sha256=tQzUnBreoQcxv8t8a27Zmh6I7EewqmKZ7HzDO9gty0A,13235
40
40
  accrete/contrib/ui/tests.py,sha256=mrbGGRNg5jwbTJtWWa7zSKdDyeB4vmgZCRc2nk6VY-g,60
41
41
  accrete/contrib/ui/urls.py,sha256=TUBlz_CGs9InTZoxM78GSnucA73I8knoh_obt12RUHM,186
42
42
  accrete/contrib/ui/views.py,sha256=WpBKMsxFFG8eG4IN7TW_TPE6i3OFF7gnLDTK7JMKti8,191
43
43
  accrete/contrib/ui/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
- accrete/contrib/ui/static/css/accrete.css,sha256=Yd0eoRRFp-BV7ha16bhvNuXlgdwcCBOij1HUBACUWew,2289
44
+ accrete/contrib/ui/static/css/accrete.css,sha256=nvU-3R0LJSclJMJ61pvQCRg1tWs07MpBRQIBNPPYBPg,2392
45
45
  accrete/contrib/ui/static/css/icons.css,sha256=-a9BJHrH5P02cfL5qZLZHZkyupqigWmbc5wAa0UEDrE,3035
46
46
  accrete/contrib/ui/static/icons/Logo.svg,sha256=hGZuxrAa-LRpFavFiF8Lnc7X9OQcqmb6Xl_dxx-27hM,1861
47
47
  accrete/contrib/ui/static/icons/accrete.svg,sha256=CWHJKIgk3hxL7xIaFSz2j1cK-eF1TroCbjcF58bgOIs,1024
@@ -58,16 +58,16 @@ accrete/contrib/ui/templates/django/forms/widgets/text.html,sha256=MSmLlQc7PsPoD
58
58
  accrete/contrib/ui/templates/django/forms/widgets/textarea.html,sha256=c9BTedqb3IkXLyVYd0p9pR8DFnsXCNGoxVBWZTk_Fic,278
59
59
  accrete/contrib/ui/templates/ui/detail.html,sha256=m-CpLcoK-dL5jPlIY6Hzyq2EyEqcFZ5Bn-kB-T0Oqao,510
60
60
  accrete/contrib/ui/templates/ui/form.html,sha256=HpcZCDU_ur_Zf5gpnH_F8OV6qfOYPl6Ecqg6w5RIayQ,405
61
- accrete/contrib/ui/templates/ui/layout.html,sha256=qvmJ4KTQM5Q_joxrxE_e4oDEqWkWJuB4T1iaYCLROl0,7059
61
+ accrete/contrib/ui/templates/ui/layout.html,sha256=aRC5-_co9EQiyGbtYFQ8mFDded7G-C2YnldAW4VOvQ8,7745
62
62
  accrete/contrib/ui/templates/ui/list.html,sha256=HsmJAWDZU-qCPh4mrc8vGzkULbViG5fnLcmmp-NO2-4,671
63
- accrete/contrib/ui/templates/ui/table.html,sha256=8-Xao_A_4Avm8Hbu7ctFQNUCgMGd22aCFP-Xw8FDPBc,1446
63
+ accrete/contrib/ui/templates/ui/table.html,sha256=tbtccA6cbhF_ONis7Qm7S7_VK-rClddQl7fgxcO8VbU,1469
64
64
  accrete/contrib/ui/templates/ui/partials/filter.html,sha256=l_Vi3ZRepF5lpX_KENU4AyIELSeichsVr0g2KGHcjIQ,1844
65
65
  accrete/contrib/ui/templates/ui/partials/form_errors.html,sha256=1_TQvTdiejsn-43YSyp2YfnP52P-MFYb-HGY0DLm4oA,991
66
66
  accrete/contrib/ui/templates/ui/partials/form_modal.html,sha256=FFDfI5qjOCUBSGqDjBXa8tcqN2q94wOOCNFDaiyplHQ,1032
67
- accrete/contrib/ui/templates/ui/partials/header.html,sha256=1ySXpc9TJk5wZXXqAEX5f_HmM0DbOQXaPJ8lfu265e0,3048
67
+ accrete/contrib/ui/templates/ui/partials/header.html,sha256=OhEINbE8ioFVEYZMFyqjfGTXCiFpse_gW6lvSL2amYk,2550
68
68
  accrete/contrib/ui/templates/ui/partials/onchange_form.html,sha256=K5twTGqRUW1iM2dGtdWntjsJvJVo5EIzKxX2HK-H1yw,160
69
- accrete/contrib/ui/templates/ui/partials/pagination_detail.html,sha256=9rQEaE31gU8sUFLireZ9iju78HucADBK1TQOb9nqw2I,1003
70
- accrete/contrib/ui/templates/ui/partials/pagination_list.html,sha256=MkIRMnCCUnK7Ksoy4SqXdMtnpqgHeCv5GyMN3tzNfCc,1232
69
+ accrete/contrib/ui/templates/ui/partials/pagination_detail.html,sha256=Mbqg8mOApBMnU-64lW-Z_H4v_PWd0UmuEiCWho5vUus,882
70
+ accrete/contrib/ui/templates/ui/partials/pagination_list.html,sha256=e4DOGaPa9fBrTFCwoW-UphNoJFlzrxFrU050bM1Cnbw,1146
71
71
  accrete/contrib/ui/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
72
72
  accrete/contrib/ui/templatetags/accrete_ui.py,sha256=otBEHrMM4JuYtx9DuK52OE1YM5vwS8KGs8CGevGwBpE,2478
73
73
  accrete/contrib/user/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -101,7 +101,7 @@ accrete/migrations/0002_initial.py,sha256=dFOM7kdHlx7pVAh8cTDlZMtciN4O9Z547HAzEK
101
101
  accrete/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
102
102
  accrete/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
103
103
  accrete/utils/dates.py,sha256=XI58CqabLCC-Sg6qo5TPWh-pHuuZfDdGDU6KQeAMlGo,1066
104
- accrete-0.0.10.dist-info/METADATA,sha256=BrF6ss_yzTfcZAJ8YNSwt9K3ims6g5fsbCtNx4cRJ9o,4846
105
- accrete-0.0.10.dist-info/WHEEL,sha256=9QBuHhg6FNW7lppboF2vKVbCGTVzsFykgRQjjlajrhA,87
106
- accrete-0.0.10.dist-info/licenses/LICENSE,sha256=_7laeMIHnsd3Y2vJEXDYXq_PEXxIcjgJsGt8UIKTRWc,1057
107
- accrete-0.0.10.dist-info/RECORD,,
104
+ accrete-0.0.11.dist-info/METADATA,sha256=eAKqMGGLjjOGsbVzWBbIn9mS3ke6FEh7JsvTDIhaJEc,4846
105
+ accrete-0.0.11.dist-info/WHEEL,sha256=9QBuHhg6FNW7lppboF2vKVbCGTVzsFykgRQjjlajrhA,87
106
+ accrete-0.0.11.dist-info/licenses/LICENSE,sha256=_7laeMIHnsd3Y2vJEXDYXq_PEXxIcjgJsGt8UIKTRWc,1057
107
+ accrete-0.0.11.dist-info/RECORD,,