django-smartbase-admin 0.2.74__py3-none-any.whl → 0.2.76__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.
- django_smartbase_admin/actions/admin_action_list.py +3 -1
- django_smartbase_admin/engine/admin_base_view.py +29 -28
- django_smartbase_admin/engine/field_formatter.py +11 -2
- django_smartbase_admin/services/views.py +1 -0
- {django_smartbase_admin-0.2.74.dist-info → django_smartbase_admin-0.2.76.dist-info}/METADATA +1 -1
- {django_smartbase_admin-0.2.74.dist-info → django_smartbase_admin-0.2.76.dist-info}/RECORD +8 -8
- {django_smartbase_admin-0.2.74.dist-info → django_smartbase_admin-0.2.76.dist-info}/LICENSE.md +0 -0
- {django_smartbase_admin-0.2.74.dist-info → django_smartbase_admin-0.2.76.dist-info}/WHEEL +0 -0
|
@@ -184,7 +184,9 @@ class SBAdminListAction(SBAdminAction):
|
|
|
184
184
|
tabulator_definition["tableIdColumnName"] = id_column_name
|
|
185
185
|
tabulator_definition["constants"] = constants
|
|
186
186
|
|
|
187
|
-
list_actions = self.list_actions or self.view._get_sbadmin_list_actions(
|
|
187
|
+
list_actions = self.list_actions or self.view._get_sbadmin_list_actions(
|
|
188
|
+
self.threadsafe_request
|
|
189
|
+
)
|
|
188
190
|
|
|
189
191
|
context_data.update(
|
|
190
192
|
{
|
|
@@ -184,10 +184,10 @@ class SBAdminBaseView(object):
|
|
|
184
184
|
"initials": request.request_data.user.username[0],
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
def get_sbadmin_detail_actions(self, object_id):
|
|
187
|
+
def get_sbadmin_detail_actions(self, request, object_id: int | str | None = None):
|
|
188
188
|
return self.sbadmin_detail_actions
|
|
189
189
|
|
|
190
|
-
def get_global_context(self, request, object_id=None):
|
|
190
|
+
def get_global_context(self, request, object_id: int | str | None = None):
|
|
191
191
|
return {
|
|
192
192
|
"view_id": self.get_id(),
|
|
193
193
|
"configuration": request.request_data.configuration,
|
|
@@ -195,7 +195,7 @@ class SBAdminBaseView(object):
|
|
|
195
195
|
"DETAIL_STRUCTURE_RIGHT_CLASS": DETAIL_STRUCTURE_RIGHT_CLASS,
|
|
196
196
|
"OVERRIDE_CONTENT_OF_NOTIFICATION": OVERRIDE_CONTENT_OF_NOTIFICATION,
|
|
197
197
|
"username_data": self.get_username_data(request),
|
|
198
|
-
"detail_actions": self.get_sbadmin_detail_actions(object_id),
|
|
198
|
+
"detail_actions": self.get_sbadmin_detail_actions(request, object_id),
|
|
199
199
|
"const": json.dumps(
|
|
200
200
|
{
|
|
201
201
|
"MULTISELECT_FILTER_MAX_CHOICES_SHOWN": MULTISELECT_FILTER_MAX_CHOICES_SHOWN,
|
|
@@ -326,27 +326,27 @@ class SBAdminBaseListView(SBAdminBaseView):
|
|
|
326
326
|
def init_actions(self, request):
|
|
327
327
|
if self.sbadmin_actions_initialized:
|
|
328
328
|
return
|
|
329
|
-
self.process_actions(request, self.get_sbadmin_list_selection_actions())
|
|
329
|
+
self.process_actions(request, self.get_sbadmin_list_selection_actions(request))
|
|
330
330
|
self.sbadmin_actions_initialized = True
|
|
331
331
|
|
|
332
332
|
def init_view_dynamic(self, request, request_data=None, **kwargs):
|
|
333
333
|
super().init_view_dynamic(request, request_data, **kwargs)
|
|
334
334
|
self.init_fields_cache(
|
|
335
|
-
self.
|
|
335
|
+
self.get_sbadmin_list_display(request), request.request_data.configuration
|
|
336
336
|
)
|
|
337
337
|
self.init_actions(request)
|
|
338
338
|
|
|
339
|
-
def
|
|
339
|
+
def get_sbadmin_list_display(self, request):
|
|
340
340
|
return self.sbadmin_list_display or self.list_display
|
|
341
341
|
|
|
342
342
|
def register_autocomplete_views(self, request):
|
|
343
343
|
super().register_autocomplete_views(request)
|
|
344
344
|
self.init_fields_cache(
|
|
345
|
-
self.
|
|
345
|
+
self.get_sbadmin_list_display(request),
|
|
346
346
|
request.request_data.configuration,
|
|
347
347
|
force=True,
|
|
348
348
|
)
|
|
349
|
-
for list_action in self.get_sbadmin_list_selection_actions():
|
|
349
|
+
for list_action in self.get_sbadmin_list_selection_actions(request):
|
|
350
350
|
if isinstance(list_action, SBAdminFormViewAction):
|
|
351
351
|
form = list_action.target_view.form_class
|
|
352
352
|
form.view = self
|
|
@@ -355,7 +355,7 @@ class SBAdminBaseListView(SBAdminBaseView):
|
|
|
355
355
|
def get_list_display(self, request):
|
|
356
356
|
return [
|
|
357
357
|
getattr(field, "name", field)
|
|
358
|
-
for field in self.
|
|
358
|
+
for field in self.get_sbadmin_list_display(request)
|
|
359
359
|
]
|
|
360
360
|
|
|
361
361
|
def get_search_fields(self, request):
|
|
@@ -447,8 +447,8 @@ class SBAdminBaseListView(SBAdminBaseView):
|
|
|
447
447
|
)
|
|
448
448
|
return tabulator_definition
|
|
449
449
|
|
|
450
|
-
def _get_sbadmin_list_actions(self):
|
|
451
|
-
list_actions = [*(self.get_sbadmin_list_actions() or [])]
|
|
450
|
+
def _get_sbadmin_list_actions(self, request):
|
|
451
|
+
list_actions = [*(self.get_sbadmin_list_actions(request) or [])]
|
|
452
452
|
if self.is_reorder_available():
|
|
453
453
|
list_actions = [
|
|
454
454
|
*list_actions,
|
|
@@ -461,7 +461,7 @@ class SBAdminBaseListView(SBAdminBaseView):
|
|
|
461
461
|
]
|
|
462
462
|
return list_actions
|
|
463
463
|
|
|
464
|
-
def get_sbadmin_list_actions(self):
|
|
464
|
+
def get_sbadmin_list_actions(self, request):
|
|
465
465
|
if not self.sbadmin_list_actions:
|
|
466
466
|
self.sbadmin_list_actions = [
|
|
467
467
|
SBAdminCustomAction(
|
|
@@ -472,7 +472,7 @@ class SBAdminBaseListView(SBAdminBaseView):
|
|
|
472
472
|
]
|
|
473
473
|
return self.sbadmin_list_actions
|
|
474
474
|
|
|
475
|
-
def get_sbadmin_list_selection_actions(self):
|
|
475
|
+
def get_sbadmin_list_selection_actions(self, request):
|
|
476
476
|
if not self.sbadmin_list_selection_actions:
|
|
477
477
|
self.sbadmin_list_selection_actions = [
|
|
478
478
|
SBAdminCustomAction(
|
|
@@ -492,7 +492,7 @@ class SBAdminBaseListView(SBAdminBaseView):
|
|
|
492
492
|
def get_sbadmin_list_selection_actions_grouped(self, request):
|
|
493
493
|
result = {}
|
|
494
494
|
list_selection_actions = self.process_actions(
|
|
495
|
-
request, self.get_sbadmin_list_selection_actions()
|
|
495
|
+
request, self.get_sbadmin_list_selection_actions(request)
|
|
496
496
|
)
|
|
497
497
|
for action in list_selection_actions:
|
|
498
498
|
if not result.get(action.group):
|
|
@@ -553,19 +553,20 @@ class SBAdminBaseListView(SBAdminBaseView):
|
|
|
553
553
|
updated_configuration = None
|
|
554
554
|
if request.request_data.request_method == "POST":
|
|
555
555
|
if name:
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
556
|
+
(
|
|
557
|
+
updated_configuration,
|
|
558
|
+
created,
|
|
559
|
+
) = SBAdminListViewConfiguration.objects.update_or_create(
|
|
560
|
+
name=name,
|
|
561
|
+
user_id=request.request_data.user.id,
|
|
562
|
+
defaults={
|
|
563
|
+
"url_params": request.request_data.request_post.get(
|
|
564
|
+
URL_PARAMS_NAME
|
|
565
|
+
),
|
|
566
|
+
"view": self.get_id(),
|
|
567
|
+
"action": None,
|
|
568
|
+
"modifier": None,
|
|
569
|
+
},
|
|
569
570
|
)
|
|
570
571
|
if request.request_data.request_method == "DELETE":
|
|
571
572
|
if name:
|
|
@@ -644,7 +645,7 @@ class SBAdminBaseListView(SBAdminBaseView):
|
|
|
644
645
|
list_filter = self.get_sbadmin_list_filter(request) or []
|
|
645
646
|
if not list_filter:
|
|
646
647
|
return all_config
|
|
647
|
-
list_fields = self.
|
|
648
|
+
list_fields = self.get_sbadmin_list_display(request) or []
|
|
648
649
|
self.init_fields_cache(list_fields, request.request_data.configuration)
|
|
649
650
|
base_filter = {
|
|
650
651
|
getattr(field, "filter_field", field): ""
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
|
|
1
3
|
from django.template.defaultfilters import date, time
|
|
2
4
|
from django.utils.translation import gettext_lazy as _
|
|
3
5
|
from django.utils import timezone
|
|
4
6
|
|
|
5
7
|
|
|
8
|
+
class BadgeType(Enum):
|
|
9
|
+
SUCCESS = "positive"
|
|
10
|
+
NOTICE = "notice"
|
|
11
|
+
WARNING = "warning"
|
|
12
|
+
ERROR = "negative"
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
def datetime_formatter(object_id, value):
|
|
7
16
|
if value is None:
|
|
8
17
|
return None
|
|
@@ -33,14 +42,14 @@ def boolean_formatter(object_id, value):
|
|
|
33
42
|
return f'<span class="badge badge-simple badge-neutral">{_("No")}</span>'
|
|
34
43
|
|
|
35
44
|
|
|
36
|
-
def format_array(value_list, separator=""):
|
|
45
|
+
def format_array(value_list, separator="", badge_type: BadgeType = BadgeType.NOTICE):
|
|
37
46
|
result = ""
|
|
38
47
|
if not value_list:
|
|
39
48
|
return result
|
|
40
49
|
for value in value_list:
|
|
41
50
|
if not value:
|
|
42
51
|
continue
|
|
43
|
-
result += f'<span class="badge badge-simple badge-
|
|
52
|
+
result += f'<span class="badge badge-simple badge-{badge_type.value} mr-4">{value}</span>{separator}'
|
|
44
53
|
return result
|
|
45
54
|
|
|
46
55
|
|
|
@@ -34,6 +34,7 @@ class SBAdminViewService(object):
|
|
|
34
34
|
|
|
35
35
|
@classmethod
|
|
36
36
|
def process_url_params(cls, view_id, url_params, filter_version):
|
|
37
|
+
url_params = url_params or {}
|
|
37
38
|
filter_data = SBAdminViewService.process_filter_data_url(
|
|
38
39
|
view_id=view_id,
|
|
39
40
|
filter_data=url_params.get(FILTER_DATA_NAME, {}),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
django_smartbase_admin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
django_smartbase_admin/actions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
django_smartbase_admin/actions/admin_action_list.py,sha256=
|
|
3
|
+
django_smartbase_admin/actions/admin_action_list.py,sha256=PBkuzK7QXkOtPKfNmCi1HA-1-Evpxpulg1I5ezXiCa8,19274
|
|
4
4
|
django_smartbase_admin/actions/advanced_filters.py,sha256=Vm8b6TAwNehR8INjolFG7pEYL4ADO7XUiVOWpb0btM0,13481
|
|
5
5
|
django_smartbase_admin/admin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
django_smartbase_admin/admin/admin_base.py,sha256=9fN3c41fNkav7uQiGfEnJaiqYKfDk57VrlYgiN04DE8,40100
|
|
@@ -10,7 +10,7 @@ django_smartbase_admin/apps.py,sha256=3Wm88v1u-ejKVSRsdgsnOrjOfdlsp1qVULskabgH1i
|
|
|
10
10
|
django_smartbase_admin/compilemessages.py,sha256=-_FEFQlOvE4L8UzSuUxSxZQjgGlwL9IZtmg59fW_kIQ,342
|
|
11
11
|
django_smartbase_admin/engine/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
12
|
django_smartbase_admin/engine/actions.py,sha256=n8PiG60Kj1ECHB4lfVH_jvHMyOjOZ-DvQfO9F2CuqW0,1733
|
|
13
|
-
django_smartbase_admin/engine/admin_base_view.py,sha256=
|
|
13
|
+
django_smartbase_admin/engine/admin_base_view.py,sha256=EfoxYGaDNtUbr2vUnwvws2JWG2ipQDin9JQKPkDYt5g,28575
|
|
14
14
|
django_smartbase_admin/engine/admin_entrypoint_view.py,sha256=jfMfcYPfdre2abHfC4KIxaP_epJFuCeTcujGhGd4Tl4,624
|
|
15
15
|
django_smartbase_admin/engine/admin_view.py,sha256=9wGffahDR3IYmhL9ZbX8uitwGdXdw5DIL5GnWBawmJM,4238
|
|
16
16
|
django_smartbase_admin/engine/configuration.py,sha256=P3iSiPm9QBl9etTDJIWzo7DzOBCryGwWtbF288PEtus,8120
|
|
@@ -18,7 +18,7 @@ django_smartbase_admin/engine/const.py,sha256=vU_XMy76BYiw1tu88lw8UDGk-cW5oo62gh
|
|
|
18
18
|
django_smartbase_admin/engine/dashboard.py,sha256=wrvX0GI-SII2pG0DX8Kvy4JFaM6h8e6R7KSCFddFC64,23642
|
|
19
19
|
django_smartbase_admin/engine/fake_inline.py,sha256=9C2_mltg2P9-xa3vuoo5X_RcFaCRpKGNSy7t1_iiasE,5802
|
|
20
20
|
django_smartbase_admin/engine/field.py,sha256=BD_W0ekE5tQJxUGpUA8bo4ZyFk0u2F_6UTPH4drj0JU,10286
|
|
21
|
-
django_smartbase_admin/engine/field_formatter.py,sha256=
|
|
21
|
+
django_smartbase_admin/engine/field_formatter.py,sha256=eHbXEBwG8jBc9zKpDQ4T64N5J4afF0Cbb8RFeFfgQRg,1950
|
|
22
22
|
django_smartbase_admin/engine/filter_widgets.py,sha256=lHPMilA2tjtwnwqPw2nUE39BL1Dx_v4HNKhmg6szHUY,23687
|
|
23
23
|
django_smartbase_admin/engine/global_filter_form.py,sha256=jlj6e9VYWDPyUNjcgj3gTIkCZXO01NZOWAeU3jFtkoA,249
|
|
24
24
|
django_smartbase_admin/engine/menu_item.py,sha256=rMJFG5xm1T0wF8lUmiAZHzKtt9C0LdbpRFvaP0PlngM,2936
|
|
@@ -42,7 +42,7 @@ django_smartbase_admin/services/configuration.py,sha256=POMI0htBqFS9ptPXMtOhIlIK
|
|
|
42
42
|
django_smartbase_admin/services/data.py,sha256=o36B_H9RnBvaQz3Rs3NygY1hVTr6hc89M-RK1saRXzc,156
|
|
43
43
|
django_smartbase_admin/services/thread_local.py,sha256=C3x7hPsKRCddr05RGiN0f6fcSQ8qsrYRdx9oeMHRovU,293
|
|
44
44
|
django_smartbase_admin/services/translations.py,sha256=aiekREx8KQA9CQRmtkUcys4ICJERMrkxPnLysp0YXO8,5606
|
|
45
|
-
django_smartbase_admin/services/views.py,sha256=
|
|
45
|
+
django_smartbase_admin/services/views.py,sha256=Drg5Y_sYyzVGEDjpT0e5bZAbylD_GdQMXKApxEr31cg,8991
|
|
46
46
|
django_smartbase_admin/services/xlsx_export.py,sha256=fnIqahmZR6G5T5wSH-sXhhLSy1QD3A-OY6BAn1WLLOc,10723
|
|
47
47
|
django_smartbase_admin/static/sb_admin/build/postcss.config.js,sha256=JlIB66vejH4YA3sPp7hDjimQXAGz5WlVhFDwjBDNTEo,610
|
|
48
48
|
django_smartbase_admin/static/sb_admin/build/tailwind.config.js,sha256=5q5CGlXyn5s3hB6k2OCTu4auVcY4_yop5TrM5g0pT80,2369
|
|
@@ -658,7 +658,7 @@ django_smartbase_admin/views/dashboard_view.py,sha256=vtz5emYTQ5WDFeLA8HrcmjSOVd
|
|
|
658
658
|
django_smartbase_admin/views/global_filter_view.py,sha256=eYo1moJGyi7jc2cPDA5ZBiEgA7Hmc-DxbQvbqUpDkg8,1127
|
|
659
659
|
django_smartbase_admin/views/media_view.py,sha256=5BLWXuzynF7nM34t-mf2BQSRN5ojY8HxpLIqt7Jiq9g,292
|
|
660
660
|
django_smartbase_admin/views/translations_view.py,sha256=A02q1t13akLKd2Pg_ej4tVi5qPUKYxB2LqsBbYXM0l8,20267
|
|
661
|
-
django_smartbase_admin-0.2.
|
|
662
|
-
django_smartbase_admin-0.2.
|
|
663
|
-
django_smartbase_admin-0.2.
|
|
664
|
-
django_smartbase_admin-0.2.
|
|
661
|
+
django_smartbase_admin-0.2.76.dist-info/LICENSE.md,sha256=okRGMBOYvyhprt2eTpX_QXqpzC0MODF-U7zX-4fKPjQ,1078
|
|
662
|
+
django_smartbase_admin-0.2.76.dist-info/METADATA,sha256=p7yKt3m3ia1-4YILAfw3838yhaPSJgrNZfwtUhJfOsI,945
|
|
663
|
+
django_smartbase_admin-0.2.76.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
664
|
+
django_smartbase_admin-0.2.76.dist-info/RECORD,,
|
{django_smartbase_admin-0.2.74.dist-info → django_smartbase_admin-0.2.76.dist-info}/LICENSE.md
RENAMED
|
File without changes
|
|
File without changes
|