django-smartbase-admin 1.0.22__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.
@@ -322,7 +322,7 @@ class Main {
322
322
  fileInput.querySelectorAll('.js-input-file-image').forEach(el => {
323
323
  const nameSplit= e.target.files[0].name.split('.')
324
324
  const extension = nameSplit[nameSplit.length - 1]
325
- if(['jpg', 'png', 'svg', 'webp'].includes(extension)) {
325
+ if(['jpg', 'jpeg', 'png', 'svg', 'webp'].includes(extension)) {
326
326
  el.src = URL.createObjectURL(e.target.files[0])
327
327
  el.classList.add('border')
328
328
  return
@@ -1,4 +1,7 @@
1
1
  {% include 'sb_admin/widgets/includes/field_label.html' %}
2
2
  <div {% include "sb_admin/widgets/attrs.html" %}>
3
3
  <p class="text-14 leading-18 read-only-password-hash">{{ widget.form_field.help_text|safe }}</p>
4
+ {% if button_label %}
5
+ <p class="mt-8"><a class="btn btn-small" href="{{ password_url|default:"../password/" }}">{{ button_label }}</a></p>
6
+ {% endif %}
4
7
  </div>
@@ -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,
@@ -259,18 +260,23 @@ def get_file_preview_image(
259
260
  file, file_extension=None, thumbnail_width=64, thumbnail_height=64
260
261
  ):
261
262
  file_extension = file_extension or get_file_extension(file)
262
- if file_extension in ["jpg", "png"]:
263
+ if file_extension in ["jpg", "jpeg", "png"]:
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.22
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)
@@ -5,7 +5,7 @@ django_smartbase_admin/actions/advanced_filters.py,sha256=Vm8b6TAwNehR8INjolFG7p
5
5
  django_smartbase_admin/admin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  django_smartbase_admin/admin/admin_base.py,sha256=lU73GWjWvrPTsIXgmLaR88ie_K71J4NsU7qUqSzDrqg,47274
7
7
  django_smartbase_admin/admin/site.py,sha256=sJiVX2ljUgNN6MnlLfsTyJs7Dl52iC2rtLwkg962ydM,6841
8
- django_smartbase_admin/admin/widgets.py,sha256=7w2kYK-1EAUb7ZCOi10EqAZPZYaCWUhCcji-062OdPo,26240
8
+ django_smartbase_admin/admin/widgets.py,sha256=OhPZfQ7GR6dgS9Yg_OlkFxSva06Hp28_V-40ZxxkFf8,26216
9
9
  django_smartbase_admin/apps.py,sha256=heZq5O2GHlkJdhUCHbRR7Nmm0irSxnL9NMqY43_O7V4,599
10
10
  django_smartbase_admin/compilemessages.py,sha256=-_FEFQlOvE4L8UzSuUxSxZQjgGlwL9IZtmg59fW_kIQ,342
11
11
  django_smartbase_admin/engine/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -68,7 +68,7 @@ django_smartbase_admin/static/sb_admin/dist/calendar_style.js,sha256=47DEQpj8HBS
68
68
  django_smartbase_admin/static/sb_admin/dist/chart.js,sha256=nBru0P3RvzaNeQch6qkuL1Wi_c9ICz94HXLXmyYTMW8,205022
69
69
  django_smartbase_admin/static/sb_admin/dist/chart.js.LICENSE.txt,sha256=m7M__mzLlrKDz-hky_AC848p_HzYWhziwCLIpXMsj4I,257
70
70
  django_smartbase_admin/static/sb_admin/dist/confirmation_modal.js,sha256=glK-x4oxSAHqiabqXmNFE3FRtzMbpg7TgZiKcPle9_o,1745
71
- django_smartbase_admin/static/sb_admin/dist/main.js,sha256=4IJGPvsx_VFDVfMQvYPLE0rYApzqRJYUElvpbb5sF6o,382935
71
+ django_smartbase_admin/static/sb_admin/dist/main.js,sha256=UnLg-m3yeuo5aP1KvDkhaBjxtLixcaDQCFrlSfq8u5c,382942
72
72
  django_smartbase_admin/static/sb_admin/dist/main.js.LICENSE.txt,sha256=Z8-1IrzhOFV3eE_WGR7SRfbzN9GRXsvfiU7_E_BkX-k,5600
73
73
  django_smartbase_admin/static/sb_admin/dist/main_style.css,sha256=Z1TXgv-meax_fdZoNqRZqCjaDal89hik4lqFSa_KUtY,178358
74
74
  django_smartbase_admin/static/sb_admin/dist/main_style.js,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -539,7 +539,7 @@ django_smartbase_admin/static/sb_admin/src/js/code.js,sha256=Q1jKpTsUZhxhaGDRrqH
539
539
  django_smartbase_admin/static/sb_admin/src/js/confirmation_modal.js,sha256=9xycy0sYJfT0SxeDucbOmvg9gHSrBo3KngZjCAHkVMM,3610
540
540
  django_smartbase_admin/static/sb_admin/src/js/datepicker.js,sha256=Nnc28kngTOnb8d2q6NOFGismUVp6l-sTVeBu3M1DgJY,6704
541
541
  django_smartbase_admin/static/sb_admin/src/js/datepicker_plugins.js,sha256=DVIyCJpxn8Gx1mx3QHxbRN4nlpJRlilKix6BK_zcUVc,12382
542
- django_smartbase_admin/static/sb_admin/src/js/main.js,sha256=GfEk6isVJkSttX9dnQZkSZyZzdFjAWsFqFBS_dmh3ck,15749
542
+ django_smartbase_admin/static/sb_admin/src/js/main.js,sha256=gIdlXGM4TJDtu50sO5NwWgRTmojRVnVQp6JDTJR403A,15757
543
543
  django_smartbase_admin/static/sb_admin/src/js/multiselect.js,sha256=GuWjIpdkfvXi-oBNdK3gImjrzef4550MKMy71iYrywk,4066
544
544
  django_smartbase_admin/static/sb_admin/src/js/range.js,sha256=k_1EIK0R-mrg3ScopUm2UDuYeaCg_VLTjtdJoN-8MXc,1794
545
545
  django_smartbase_admin/static/sb_admin/src/js/sb_ajax_params_tabulator_modifier.js,sha256=vJsAfRlXYeUH-hXLyVukim-UBRUHhv2J9UZHKAALOKo,650
@@ -691,7 +691,7 @@ django_smartbase_admin/templates/sb_admin/widgets/password.html,sha256=Ss3pHx4Up
691
691
  django_smartbase_admin/templates/sb_admin/widgets/radio.html,sha256=rnO1lUc9mWumBTQ0OTFVmFRmL_mokDbzr4I-pjNiP5k,500
692
692
  django_smartbase_admin/templates/sb_admin/widgets/radio_dropdown.html,sha256=TK7pAujkcfWX1EUbxveXDo73kzTXNo7ITMMas8P5urs,1350
693
693
  django_smartbase_admin/templates/sb_admin/widgets/radio_option.html,sha256=vxY2AvB9YmVapEym1RDaRm074CZrKRxjWrfum5Xy9ys,51
694
- django_smartbase_admin/templates/sb_admin/widgets/read_only_password_hash.html,sha256=Eb9wlfJVmznmDhF9pBUntejB0gk_WVAYdvIVE7rSZAE,216
694
+ django_smartbase_admin/templates/sb_admin/widgets/read_only_password_hash.html,sha256=qrJyIkqFt_9dovi48uyMYXLjSQdTw9vOL6Ypc06FYUE,383
695
695
  django_smartbase_admin/templates/sb_admin/widgets/select.html,sha256=BZvKWk9oAUJQwsqCcZ-j-YsDUbEhMTvqNuEDgix87_w,496
696
696
  django_smartbase_admin/templates/sb_admin/widgets/select_date.html,sha256=Vq40uBmv89Qyq14IPqudLUoH-aAVocvnDSJPftbAMOs,50
697
697
  django_smartbase_admin/templates/sb_admin/widgets/select_option.html,sha256=Jp8ibN10VO1u7iTxhT7g0Hkg_EQOrMBiBVbKT0g6JjE,123
@@ -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=V8EUaS1adBAbmJ49Ntmoj2cXnDiAt7VQEbVXvCiNT_Q,9374
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.22.dist-info/LICENSE.md,sha256=okRGMBOYvyhprt2eTpX_QXqpzC0MODF-U7zX-4fKPjQ,1078
720
- django_smartbase_admin-1.0.22.dist-info/METADATA,sha256=bRXtkqqRMYPwtZSyZqm997liG7BlVhsXEBWhp3NJZic,5375
721
- django_smartbase_admin-1.0.22.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
722
- django_smartbase_admin-1.0.22.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,,