django-smartbase-admin 1.0.3__py3-none-any.whl → 1.0.5__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/widgets.py +1 -3
- django_smartbase_admin/engine/actions.py +8 -0
- django_smartbase_admin/engine/field.py +16 -2
- django_smartbase_admin/monkeypatch/fake_inline_monkeypatch.py +1 -1
- django_smartbase_admin/static/sb_admin/dist/main_style.css +1 -1
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Bolt-one.svg +3 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Electric-drill.svg +3 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Fire-extinguisher.svg +3 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Gas.svg +3 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Lightning-fill.svg +3 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Printer.svg +3 -0
- django_smartbase_admin/static/sb_admin/sprites/sb_admin/Pull.svg +3 -0
- django_smartbase_admin/templates/sb_admin/actions/list.html +40 -14
- django_smartbase_admin/templates/sb_admin/actions/partials/action_link.html +14 -0
- django_smartbase_admin/templates/sb_admin/sprites/sb_admin.svg +1 -1
- django_smartbase_admin/views/translations_view.py +4 -3
- {django_smartbase_admin-1.0.3.dist-info → django_smartbase_admin-1.0.5.dist-info}/METADATA +12 -3
- {django_smartbase_admin-1.0.3.dist-info → django_smartbase_admin-1.0.5.dist-info}/RECORD +20 -12
- {django_smartbase_admin-1.0.3.dist-info → django_smartbase_admin-1.0.5.dist-info}/LICENSE.md +0 -0
- {django_smartbase_admin-1.0.3.dist-info → django_smartbase_admin-1.0.5.dist-info}/WHEEL +0 -0
|
@@ -205,9 +205,7 @@ class SBAdminDateWidget(SBAdminBaseWidget, forms.DateInput):
|
|
|
205
205
|
"flatpickrOptions": {
|
|
206
206
|
"dateFormat": "Y-m-d",
|
|
207
207
|
"altInput": True,
|
|
208
|
-
"altFormat": get_format(
|
|
209
|
-
"SHORT_DATE_FORMAT", use_l10n=settings.USE_L10N
|
|
210
|
-
),
|
|
208
|
+
"altFormat": get_format("SHORT_DATE_FORMAT"),
|
|
211
209
|
},
|
|
212
210
|
},
|
|
213
211
|
cls=SBAdminJSONEncoder,
|
|
@@ -22,6 +22,8 @@ class SBAdminCustomAction(object):
|
|
|
22
22
|
no_params=False,
|
|
23
23
|
open_in_modal=False,
|
|
24
24
|
group=None,
|
|
25
|
+
sub_actions=None,
|
|
26
|
+
icon=None,
|
|
25
27
|
) -> None:
|
|
26
28
|
super().__init__()
|
|
27
29
|
self.title = title
|
|
@@ -33,9 +35,15 @@ class SBAdminCustomAction(object):
|
|
|
33
35
|
self.no_params = no_params
|
|
34
36
|
self.open_in_modal = open_in_modal
|
|
35
37
|
self.group = group
|
|
38
|
+
self.sub_actions = sub_actions
|
|
39
|
+
self.icon = icon
|
|
36
40
|
self.resolve_url()
|
|
37
41
|
|
|
38
42
|
def resolve_url(self):
|
|
43
|
+
if self.sub_actions:
|
|
44
|
+
for sub_action in self.sub_actions:
|
|
45
|
+
sub_action.resolve_url()
|
|
46
|
+
return
|
|
39
47
|
if not (self.url or (self.view and self.action_id)):
|
|
40
48
|
raise ImproperlyConfigured(
|
|
41
49
|
"You must provide either url or view and action_id"
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
from django.core.exceptions import FieldDoesNotExist, FieldError, ImproperlyConfigured
|
|
2
|
-
from django.db.models import
|
|
2
|
+
from django.db.models import (
|
|
3
|
+
Count,
|
|
4
|
+
Value,
|
|
5
|
+
CharField,
|
|
6
|
+
F,
|
|
7
|
+
DateTimeField,
|
|
8
|
+
BooleanField,
|
|
9
|
+
FilteredRelation,
|
|
10
|
+
)
|
|
3
11
|
from django.db.models.functions import Concat
|
|
4
12
|
|
|
5
13
|
from django_smartbase_admin.engine.const import ANNOTATE_KEY, Formatter
|
|
@@ -268,5 +276,11 @@ class SBAdminField(JSONSerializableMixin):
|
|
|
268
276
|
else:
|
|
269
277
|
field_annotates[self.field] = Value(None, output_field=CharField())
|
|
270
278
|
if self.supporting_annotates:
|
|
271
|
-
supporting_annotates.
|
|
279
|
+
for key, value in self.supporting_annotates.items():
|
|
280
|
+
# workaround for a django bug
|
|
281
|
+
# https://code.djangoproject.com/ticket/36442#ticket
|
|
282
|
+
if isinstance(value, FilteredRelation):
|
|
283
|
+
supporting_annotates[key] = value.clone()
|
|
284
|
+
else:
|
|
285
|
+
supporting_annotates[key] = value
|
|
272
286
|
return {**supporting_annotates, **field_annotates}
|
|
@@ -14,7 +14,7 @@ def monkeypatch_get_foreign_key(fnc):
|
|
|
14
14
|
result = models.ForeignKey(
|
|
15
15
|
model.original_model, on_delete=models.DO_NOTHING
|
|
16
16
|
)
|
|
17
|
-
result.
|
|
17
|
+
result.set_attributes_from_name(SBAdminFakeInlineMixin.fk_name)
|
|
18
18
|
|
|
19
19
|
return result
|
|
20
20
|
|