django-smartbase-admin 1.0.5__py3-none-any.whl → 1.0.6b2__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/admin/admin_base.py +142 -35
- django_smartbase_admin/admin/widgets.py +63 -1
- django_smartbase_admin/engine/admin_base_view.py +30 -21
- django_smartbase_admin/engine/configuration.py +30 -21
- django_smartbase_admin/static/sb_admin/dist/main.js +1 -1
- django_smartbase_admin/static/sb_admin/dist/main_style.css +1 -1
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Caution.svg +3 -0
- django_smartbase_admin/static/sb_admin/src/css/components/_input.css +19 -15
- django_smartbase_admin/static/sb_admin/src/js/autocomplete.js +18 -0
- django_smartbase_admin/static/sb_admin/src/js/choices.js +8 -0
- django_smartbase_admin/static/sb_admin/src/js/datepicker.js +7 -5
- django_smartbase_admin/static/sb_admin/src/js/main.js +64 -26
- django_smartbase_admin/static/sb_admin/src/js/range.js +3 -2
- django_smartbase_admin/templates/sb_admin/actions/change_form.html +75 -36
- django_smartbase_admin/templates/sb_admin/inlines/table_inline.html +49 -33
- django_smartbase_admin/templates/sb_admin/sprites/sb_admin.svg +1 -1
- django_smartbase_admin/templates/sb_admin/widgets/autocomplete.html +13 -2
- django_smartbase_admin/templates/sb_admin/widgets/date.html +1 -1
- django_smartbase_admin/templates/sb_admin/widgets/includes/related_item_buttons.html +31 -0
- django_smartbase_admin/templates/sb_admin/widgets/time.html +1 -1
- django_smartbase_admin/utils.py +5 -0
- {django_smartbase_admin-1.0.5.dist-info → django_smartbase_admin-1.0.6b2.dist-info}/METADATA +2 -2
- {django_smartbase_admin-1.0.5.dist-info → django_smartbase_admin-1.0.6b2.dist-info}/RECORD +25 -23
- {django_smartbase_admin-1.0.5.dist-info → django_smartbase_admin-1.0.6b2.dist-info}/LICENSE.md +0 -0
- {django_smartbase_admin-1.0.5.dist-info → django_smartbase_admin-1.0.6b2.dist-info}/WHEEL +0 -0
|
@@ -8,7 +8,7 @@ from django_smartbase_admin.engine.const import (
|
|
|
8
8
|
FilterVersions,
|
|
9
9
|
Action,
|
|
10
10
|
)
|
|
11
|
-
from django_smartbase_admin.utils import to_list
|
|
11
|
+
from django_smartbase_admin.utils import to_list, is_modal
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class SBAdminConfigurationBase(object):
|
|
@@ -41,12 +41,12 @@ class SBAdminRoleConfiguration(metaclass=Singleton):
|
|
|
41
41
|
filters_version = FilterVersions.FILTERS_VERSION_1
|
|
42
42
|
|
|
43
43
|
def __init__(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
self,
|
|
45
|
+
default_view=None,
|
|
46
|
+
registered_views=None,
|
|
47
|
+
menu_items=None,
|
|
48
|
+
global_filter_form=None,
|
|
49
|
+
filters_version=None,
|
|
50
50
|
) -> None:
|
|
51
51
|
super().__init__()
|
|
52
52
|
self.default_view = default_view or self.default_view or []
|
|
@@ -134,13 +134,13 @@ class SBAdminRoleConfiguration(metaclass=Singleton):
|
|
|
134
134
|
self.autocomplete_map[view.get_id()] = view
|
|
135
135
|
|
|
136
136
|
def restrict_queryset(
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
137
|
+
self,
|
|
138
|
+
qs,
|
|
139
|
+
model,
|
|
140
|
+
request,
|
|
141
|
+
request_data,
|
|
142
|
+
global_filter=True,
|
|
143
|
+
global_filter_data_map=None,
|
|
144
144
|
):
|
|
145
145
|
return qs
|
|
146
146
|
|
|
@@ -154,7 +154,7 @@ class SBAdminRoleConfiguration(metaclass=Singleton):
|
|
|
154
154
|
return request.user.is_staff
|
|
155
155
|
|
|
156
156
|
def has_permission(
|
|
157
|
-
|
|
157
|
+
self, request, request_data, view, model=None, obj=None, permission=None
|
|
158
158
|
):
|
|
159
159
|
if isinstance(permission, SBAdminCustomAction):
|
|
160
160
|
return self.has_action_permission(
|
|
@@ -174,7 +174,7 @@ class SBAdminRoleConfiguration(metaclass=Singleton):
|
|
|
174
174
|
return request.user.is_staff
|
|
175
175
|
|
|
176
176
|
def get_autocomplete_widget(
|
|
177
|
-
|
|
177
|
+
self, view, request, form_field, db_field, model, multiselect=False
|
|
178
178
|
):
|
|
179
179
|
from django_smartbase_admin.admin.widgets import SBAdminAutocompleteWidget
|
|
180
180
|
|
|
@@ -186,12 +186,12 @@ class SBAdminRoleConfiguration(metaclass=Singleton):
|
|
|
186
186
|
return default_widget
|
|
187
187
|
|
|
188
188
|
def get_form_field_widget_class(
|
|
189
|
-
|
|
189
|
+
self, view, request, form_field, db_field, default_widget_class
|
|
190
190
|
):
|
|
191
191
|
return default_widget_class
|
|
192
192
|
|
|
193
193
|
def apply_global_filter_to_queryset(
|
|
194
|
-
|
|
194
|
+
self, qs, request, request_data, global_filter_data_map
|
|
195
195
|
):
|
|
196
196
|
global_filter_data_map = global_filter_data_map or {}
|
|
197
197
|
global_filter_data_map = {
|
|
@@ -211,9 +211,9 @@ class SBAdminRoleConfiguration(metaclass=Singleton):
|
|
|
211
211
|
except:
|
|
212
212
|
pass
|
|
213
213
|
if (
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
214
|
+
include_all_values_for_empty_fields
|
|
215
|
+
and field.name in include_all_values_for_empty_fields
|
|
216
|
+
and not field_value
|
|
217
217
|
):
|
|
218
218
|
continue
|
|
219
219
|
field_value = to_list(field_value)
|
|
@@ -226,3 +226,12 @@ class SBAdminRoleConfiguration(metaclass=Singleton):
|
|
|
226
226
|
|
|
227
227
|
def process_global_filter_response(self, response, request):
|
|
228
228
|
return response
|
|
229
|
+
|
|
230
|
+
def autocomplete_show_related_buttons(
|
|
231
|
+
self,
|
|
232
|
+
related_model,
|
|
233
|
+
field_name,
|
|
234
|
+
current_view,
|
|
235
|
+
request,
|
|
236
|
+
) -> bool:
|
|
237
|
+
return not is_modal(request)
|