django-smartbase-admin 0.2.81__py3-none-any.whl → 0.2.83__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 -0
- django_smartbase_admin/engine/admin_base_view.py +15 -10
- django_smartbase_admin/querysets.py +3 -0
- django_smartbase_admin/services/views.py +1 -1
- django_smartbase_admin/static/sb_admin/dist/table.js +1 -1
- django_smartbase_admin/static/sb_admin/src/js/table_modules/selection_module.js +7 -5
- django_smartbase_admin/static/sb_admin/src/js/table_modules/views_module.js +6 -0
- {django_smartbase_admin-0.2.81.dist-info → django_smartbase_admin-0.2.83.dist-info}/METADATA +1 -1
- {django_smartbase_admin-0.2.81.dist-info → django_smartbase_admin-0.2.83.dist-info}/RECORD +11 -11
- {django_smartbase_admin-0.2.81.dist-info → django_smartbase_admin-0.2.83.dist-info}/LICENSE.md +0 -0
- {django_smartbase_admin-0.2.81.dist-info → django_smartbase_admin-0.2.83.dist-info}/WHEEL +0 -0
|
@@ -446,6 +446,9 @@ class SBAdminListAction(SBAdminAction):
|
|
|
446
446
|
return final_data
|
|
447
447
|
|
|
448
448
|
def get_selection_queryset(self):
|
|
449
|
+
if not self.selection_data:
|
|
450
|
+
# don't run with no selection data as it will result in querying all records
|
|
451
|
+
return Q(id__in=[])
|
|
449
452
|
additional_filter = None
|
|
450
453
|
if self.selected_rows and self.selected_rows != SELECT_ALL_KEYWORD:
|
|
451
454
|
additional_filter = Q(id__in=self.selected_rows)
|
|
@@ -542,23 +542,28 @@ class SBAdminBaseListView(SBAdminBaseView):
|
|
|
542
542
|
return redirect(self.get_menu_view_url(request))
|
|
543
543
|
return response
|
|
544
544
|
|
|
545
|
-
def action_config(self, request,
|
|
545
|
+
def action_config(self, request, config_id=None):
|
|
546
546
|
from django_smartbase_admin.models import SBAdminListViewConfiguration
|
|
547
547
|
|
|
548
|
-
|
|
548
|
+
config_id = config_id if config_id != "None" else None
|
|
549
549
|
|
|
550
|
-
|
|
551
|
-
if
|
|
552
|
-
|
|
550
|
+
config_name = request.POST.get(CONFIG_NAME, None)
|
|
551
|
+
if config_name:
|
|
552
|
+
config_name = urllib.parse.unquote(config_name)
|
|
553
553
|
updated_configuration = None
|
|
554
554
|
if request.request_data.request_method == "POST":
|
|
555
|
-
|
|
555
|
+
config_params = {}
|
|
556
|
+
if config_id:
|
|
557
|
+
config_params["id"] = config_id
|
|
558
|
+
elif config_name:
|
|
559
|
+
config_params["name"] = config_name
|
|
560
|
+
if config_params:
|
|
556
561
|
(
|
|
557
562
|
updated_configuration,
|
|
558
563
|
created,
|
|
559
564
|
) = SBAdminListViewConfiguration.objects.update_or_create(
|
|
560
|
-
name=name,
|
|
561
565
|
user_id=request.request_data.user.id,
|
|
566
|
+
**config_params,
|
|
562
567
|
defaults={
|
|
563
568
|
"url_params": request.request_data.request_post.get(
|
|
564
569
|
URL_PARAMS_NAME
|
|
@@ -569,10 +574,10 @@ class SBAdminBaseListView(SBAdminBaseView):
|
|
|
569
574
|
},
|
|
570
575
|
)
|
|
571
576
|
if request.request_data.request_method == "DELETE":
|
|
572
|
-
if
|
|
577
|
+
if config_id:
|
|
573
578
|
SBAdminListViewConfiguration.objects.by_user_id(
|
|
574
579
|
request.request_data.user.id
|
|
575
|
-
).
|
|
580
|
+
).by_id(config_id).by_view_action_modifier(view=self.get_id()).delete()
|
|
576
581
|
|
|
577
582
|
redirect_to = self.get_redirect_url_from_request(request, updated_configuration)
|
|
578
583
|
|
|
@@ -697,7 +702,7 @@ class SBAdminBaseListView(SBAdminBaseView):
|
|
|
697
702
|
.values()
|
|
698
703
|
)
|
|
699
704
|
for view in current_views:
|
|
700
|
-
view["detail_url"] = self.get_config_url(view["
|
|
705
|
+
view["detail_url"] = self.get_config_url(view["id"])
|
|
701
706
|
config_views = self.get_base_config(request)
|
|
702
707
|
config_views.extend(current_views)
|
|
703
708
|
return {"current_views": config_views}
|