django-smartbase-admin 1.0.23__py3-none-any.whl → 1.0.24__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,7 @@ from django.templatetags.static import static
11
11
  from django.utils.safestring import mark_safe
12
12
  from django.utils.text import get_text_list
13
13
  from django.utils.translation import gettext
14
+ from easy_thumbnails.exceptions import InvalidImageFormatError
14
15
 
15
16
  from django_smartbase_admin.engine.const import (
16
17
  ROW_CLASS_FIELD,
@@ -263,14 +264,19 @@ def get_file_preview_image(
263
264
  from easy_thumbnails.files import get_thumbnailer
264
265
 
265
266
  thumbnailer = get_thumbnailer(file)
266
- thumb = thumbnailer.get_thumbnail(
267
- {
268
- "size": (thumbnail_width, thumbnail_height),
269
- "crop": True,
270
- "replace_alpha": "#fff",
271
- }
272
- )
273
- return thumb.url
267
+ try:
268
+ thumb = thumbnailer.get_thumbnail(
269
+ {
270
+ "size": (thumbnail_width, thumbnail_height),
271
+ "crop": True,
272
+ "replace_alpha": "#fff",
273
+ }
274
+ )
275
+ return thumb.url
276
+ except ValueError:
277
+ return file.url
278
+ except InvalidImageFormatError:
279
+ return static("sb_admin/images/file_types/file-other.svg")
274
280
  if file_extension == "svg" or file_extension == "webp":
275
281
  return file.url
276
282
  for extension in SUPPORTED_FILE_TYPE_ICONS:
@@ -1,18 +1,25 @@
1
1
  from django import forms
2
2
  from django.http import HttpResponse
3
+ from django.utils.html import format_html
3
4
  from django.views.generic import FormView
4
5
 
5
6
  from django_smartbase_admin.admin.admin_base import SBAdminBaseFormInit
6
7
  from django_smartbase_admin.admin.widgets import (
7
8
  SBAdminRadioDropdownWidget,
8
9
  )
9
- from django_smartbase_admin.models import SBAdminUserConfiguration
10
+ from django_smartbase_admin.models import SBAdminUserConfiguration, ColorScheme
10
11
  from django_smartbase_admin.services.configuration import (
11
12
  SBAdminUserConfigurationService,
12
13
  )
13
14
 
14
15
 
15
16
  class ColorSchemeForm(SBAdminBaseFormInit, forms.ModelForm):
17
+ color_scheme_icons = {
18
+ ColorScheme.AUTO.value: "Translation",
19
+ ColorScheme.DARK.value: "Moon",
20
+ ColorScheme.LIGHT.value: "Sun-one",
21
+ }
22
+
16
23
  class Meta:
17
24
  model = SBAdminUserConfiguration
18
25
  fields = ("color_scheme",)
@@ -21,6 +28,16 @@ class ColorSchemeForm(SBAdminBaseFormInit, forms.ModelForm):
21
28
  }
22
29
  required = []
23
30
 
31
+ def __init__(self, *args, **kwargs):
32
+ super().__init__(*args, **kwargs)
33
+ choices_formatted = []
34
+ for choice in self.fields["color_scheme"].choices:
35
+ choice_label = format_html(
36
+ f'<span class="flex gap-8"><svg class="w-20 h-20"><use href="#{self.color_scheme_icons.get(choice[0])}"></use></svg><span>{choice[1]}</span></span>'
37
+ )
38
+ choices_formatted.append((choice[0], choice_label))
39
+ self.fields["color_scheme"].choices = choices_formatted
40
+
24
41
 
25
42
  class ColorSchemeView(FormView):
26
43
  form_class = ColorSchemeForm
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-smartbase-admin
3
- Version: 1.0.23
3
+ Version: 1.0.24
4
4
  Summary:
5
5
  Home-page: https://smartbase-sk.github.io/django-smartbase-admin-docs/
6
6
  License: MIT
@@ -31,6 +31,8 @@ Requires-Dist: xlsxwriter (>=3.2.0,<4.0.0)
31
31
  Project-URL: Repository, https://github.com/SmartBase-SK/django-smartbase-admin
32
32
  Description-Content-Type: text/markdown
33
33
 
34
+ <img width="1660" height="520" alt="image" src="https://github.com/user-attachments/assets/b0d5537f-29c4-46ca-b514-9862b26cb000" />
35
+
34
36
  # Django SmartBase Admin
35
37
 
36
38
  A modern, modular, and developer-friendly admin interface for Django.
@@ -50,8 +52,18 @@ Built to **speed up development** of internal tools and admin panels — beautif
50
52
  - Beautiful modern UI (Tailwind CSS)
51
53
  - Responsive & mobile-friendly
52
54
  - End-user ready for building SaaS or similar projects with global queryset configuration
53
- ![image](https://github.com/user-attachments/assets/4bacb8c2-fd3d-4137-9b5a-fa849d9aeff6)
54
- ![image](https://github.com/user-attachments/assets/f7719377-eb88-42c4-8fe0-5d4ca0ff29bf)
55
+ <img width="2880" height="1720" alt="image" src="https://github.com/user-attachments/assets/ebbcacea-9052-409e-99bb-9f9e0804bbc5" />
56
+ <img width="2880" height="1720" alt="image" src="https://github.com/user-attachments/assets/8003df6a-e035-4c8f-8e90-0e710818d33e" />
57
+ <img width="2880" height="1720" alt="image" src="https://github.com/user-attachments/assets/29e116de-a8c6-4f22-8485-3e0eba5ed564" />
58
+ <img width="2880" height="1720" alt="image" src="https://github.com/user-attachments/assets/46aefe59-e49c-4483-ba1f-eb18397db6ae" />
59
+ <img width="2880" height="1720" alt="image" src="https://github.com/user-attachments/assets/ea354dcb-b4a9-47af-8046-ba0d55d72746" />
60
+ <img width="2880" height="1720" alt="image" src="https://github.com/user-attachments/assets/10a5d75c-ae3e-4e2b-aeb2-e943e6363a2f" />
61
+ <img width="2880" height="1720" alt="image" src="https://github.com/user-attachments/assets/3e6bfdbb-0c07-4fad-96f0-552cbcc9d4ae" />
62
+ <img width="2880" height="1720" alt="image" src="https://github.com/user-attachments/assets/b3acd00b-c425-4e5f-b113-97215bb85157" />
63
+ <img width="2880" height="1720" alt="image" src="https://github.com/user-attachments/assets/dc5f3f80-3325-4f5d-acec-236d6b241a7f" />
64
+ <img width="2880" height="1720" alt="image" src="https://github.com/user-attachments/assets/216d4e50-5af4-4e57-8649-1211a82f493e" />
65
+ <img width="2880" height="1720" alt="image" src="https://github.com/user-attachments/assets/167461dd-ec2e-4327-a208-4014f42100f9" />
66
+ <img width="2880" height="1720" alt="image" src="https://github.com/user-attachments/assets/3871e505-1bc9-4a6c-8457-4ad363a582af" />
55
67
 
56
68
 
57
69
  ## 📚 Full Documentation (in progress)
@@ -707,7 +707,7 @@ django_smartbase_admin/templates/sb_admin/widgets/tree_select_inline.html,sha256
707
707
  django_smartbase_admin/templates/sb_admin/widgets/url.html,sha256=piw2218tiWPfOwncIvSGAW14Gc5FIzkL_YllirK4yTs,160
708
708
  django_smartbase_admin/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
709
709
  django_smartbase_admin/templatetags/base.py,sha256=XF1wUQxUjULXfdlV-PeHvITfbw65LTHjlDzRikJa_F4,1520
710
- django_smartbase_admin/templatetags/sb_admin_tags.py,sha256=EmRtJc4G5ROZyoBbqJ0L5bUNloi3M8uA4tQ5V-5abQs,9382
710
+ django_smartbase_admin/templatetags/sb_admin_tags.py,sha256=Xd5Y3zPBTr7Rkg-V2-X47YH8YoqCGr831SudZrHKYb8,9656
711
711
  django_smartbase_admin/urls.py,sha256=Bjdewssljt0LIefjixBem9JN0kkghPvmrIETj3GdXbY,17
712
712
  django_smartbase_admin/utils.py,sha256=1SHuRAeEvXsPOHdE525o9iHTLY7DT6auUCx2mBa_w2Q,3400
713
713
  django_smartbase_admin/views/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -715,8 +715,8 @@ django_smartbase_admin/views/dashboard_view.py,sha256=Rgdq3r3JoAGfi2oUC1N_8ZE5KX
715
715
  django_smartbase_admin/views/global_filter_view.py,sha256=eYo1moJGyi7jc2cPDA5ZBiEgA7Hmc-DxbQvbqUpDkg8,1127
716
716
  django_smartbase_admin/views/media_view.py,sha256=5BLWXuzynF7nM34t-mf2BQSRN5ojY8HxpLIqt7Jiq9g,292
717
717
  django_smartbase_admin/views/translations_view.py,sha256=hktmkJIZ0EJxgnzjHLIoRDY0ckFa5wkbaoFZg32UWYw,20441
718
- django_smartbase_admin/views/user_config_view.py,sha256=7GcC8iw_GRn23AWehltJpVmSMW3Cq6WFxSuXeYiFylg,1124
719
- django_smartbase_admin-1.0.23.dist-info/LICENSE.md,sha256=okRGMBOYvyhprt2eTpX_QXqpzC0MODF-U7zX-4fKPjQ,1078
720
- django_smartbase_admin-1.0.23.dist-info/METADATA,sha256=p4Es_7vBdE1AqglEN3tjJhfR_WOisxS1toMTmRt3ibo,5375
721
- django_smartbase_admin-1.0.23.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
722
- django_smartbase_admin-1.0.23.dist-info/RECORD,,
718
+ django_smartbase_admin/views/user_config_view.py,sha256=hUSmwxgGXJog7vhiD-zGpm6smo31sLNzW2VoXapHIjc,1865
719
+ django_smartbase_admin-1.0.24.dist-info/LICENSE.md,sha256=okRGMBOYvyhprt2eTpX_QXqpzC0MODF-U7zX-4fKPjQ,1078
720
+ django_smartbase_admin-1.0.24.dist-info/METADATA,sha256=_FMnCy1kbPE_x6VQxW-Yzb4BXKi78t1nFalT1SBbtyA,6924
721
+ django_smartbase_admin-1.0.24.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
722
+ django_smartbase_admin-1.0.24.dist-info/RECORD,,