django-smartbase-admin 1.0.19__py3-none-any.whl → 1.0.22__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 +25 -14
- django_smartbase_admin/engine/dashboard.py +22 -20
- django_smartbase_admin/migrations/0006_alter_sbadminuserconfiguration_color_scheme.py +18 -0
- django_smartbase_admin/models.py +3 -14
- django_smartbase_admin/static/sb_admin/dist/calendar_style.css +1 -1
- 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/src/css/_components.css +9 -0
- django_smartbase_admin/static/sb_admin/src/css/calendar.css +33 -1
- django_smartbase_admin/static/sb_admin/src/js/main.js +24 -19
- django_smartbase_admin/templates/sb_admin/actions/dashboard.html +1 -1
- django_smartbase_admin/templates/sb_admin/dashboard/calendar_widget.html +36 -2
- django_smartbase_admin/templates/sb_admin/dashboard/chart_widget.html +1 -1
- django_smartbase_admin/templates/sb_admin/dashboard/list_widget.html +6 -0
- django_smartbase_admin/templates/sb_admin/dashboard/widget_base.html +1 -1
- django_smartbase_admin/templates/sb_admin/filter_widgets/partials/clear.html +10 -5
- django_smartbase_admin/templates/sb_admin/navigation.html +5 -3
- {django_smartbase_admin-1.0.19.dist-info → django_smartbase_admin-1.0.22.dist-info}/METADATA +1 -1
- {django_smartbase_admin-1.0.19.dist-info → django_smartbase_admin-1.0.22.dist-info}/RECORD +21 -20
- {django_smartbase_admin-1.0.19.dist-info → django_smartbase_admin-1.0.22.dist-info}/LICENSE.md +0 -0
- {django_smartbase_admin-1.0.19.dist-info → django_smartbase_admin-1.0.22.dist-info}/WHEEL +0 -0
|
@@ -12,7 +12,7 @@ from django.contrib.admin.widgets import (
|
|
|
12
12
|
from django.contrib.auth.forms import ReadOnlyPasswordHashWidget
|
|
13
13
|
from django.core.exceptions import ValidationError
|
|
14
14
|
from django.template.loader import render_to_string
|
|
15
|
-
from django.urls import reverse
|
|
15
|
+
from django.urls import reverse
|
|
16
16
|
from django.utils.formats import get_format
|
|
17
17
|
from django.utils.http import urlencode
|
|
18
18
|
from django.utils.safestring import mark_safe
|
|
@@ -22,6 +22,7 @@ from filer.fields.file import AdminFileWidget as FilerAdminFileWidget
|
|
|
22
22
|
from filer.fields.image import AdminImageWidget
|
|
23
23
|
from filer.models import File
|
|
24
24
|
|
|
25
|
+
from django_smartbase_admin.admin.site import sb_admin_site
|
|
25
26
|
from django_smartbase_admin.engine.admin_base_view import (
|
|
26
27
|
SBADMIN_PARENT_INSTANCE_PK_VAR,
|
|
27
28
|
SBADMIN_PARENT_INSTANCE_LABEL_VAR,
|
|
@@ -36,6 +37,12 @@ from django_smartbase_admin.templatetags.sb_admin_tags import (
|
|
|
36
37
|
)
|
|
37
38
|
from django_smartbase_admin.utils import is_modal
|
|
38
39
|
|
|
40
|
+
try:
|
|
41
|
+
# Django >= 5.0
|
|
42
|
+
from django.contrib.admin.exceptions import NotRegistered
|
|
43
|
+
except ImportError:
|
|
44
|
+
from django.contrib.admin.sites import NotRegistered
|
|
45
|
+
|
|
39
46
|
logger = logging.getLogger(__name__)
|
|
40
47
|
|
|
41
48
|
|
|
@@ -438,21 +445,25 @@ class SBAdminAutocompleteWidget(
|
|
|
438
445
|
return context
|
|
439
446
|
|
|
440
447
|
def add_related_buttons_urls(self, parsed_value, request, context):
|
|
441
|
-
related_model = self.model
|
|
442
|
-
app_label = related_model._meta.app_label
|
|
443
|
-
model_name = related_model._meta.model_name
|
|
444
|
-
|
|
445
448
|
try:
|
|
446
|
-
if
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
449
|
+
if hasattr(sb_admin_site, "get_model_admin"):
|
|
450
|
+
# Django >= 5.0
|
|
451
|
+
related_model_admin = sb_admin_site.get_model_admin(self.model)
|
|
452
|
+
else:
|
|
453
|
+
related_model_admin = sb_admin_site._registry.get(self.model)
|
|
454
|
+
if not related_model_admin:
|
|
455
|
+
return
|
|
456
|
+
if parsed_value and related_model_admin.has_view_or_change_permission(
|
|
457
|
+
request, self.model
|
|
458
|
+
):
|
|
459
|
+
context["widget"]["attrs"]["related_edit_url"] = (
|
|
460
|
+
related_model_admin.get_detail_url(parsed_value)
|
|
461
|
+
)
|
|
462
|
+
if related_model_admin.has_add_permission(request, self.model):
|
|
463
|
+
context["widget"]["attrs"]["related_add_url"] = (
|
|
464
|
+
related_model_admin.get_new_url(request)
|
|
450
465
|
)
|
|
451
|
-
|
|
452
|
-
if self.has_add_permission(request, self.model):
|
|
453
|
-
add_url = reverse("sb_admin:{}_{}_add".format(app_label, model_name))
|
|
454
|
-
context["widget"]["attrs"]["related_add_url"] = add_url
|
|
455
|
-
except NoReverseMatch:
|
|
466
|
+
except NotRegistered:
|
|
456
467
|
pass
|
|
457
468
|
|
|
458
469
|
def is_multiselect(self):
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
from copy import copy
|
|
2
2
|
from datetime import timedelta
|
|
3
|
-
|
|
4
3
|
from django.core.cache import cache
|
|
5
4
|
from django.db import models
|
|
6
5
|
from django.db.models import QuerySet
|
|
@@ -553,25 +552,28 @@ class SBAdminDashboardChartWidgetByDate(SBAdminDashboardChartWidget):
|
|
|
553
552
|
self.date_annotate_field
|
|
554
553
|
)
|
|
555
554
|
)
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
555
|
+
if date_range[0] and date_range[1]:
|
|
556
|
+
date_range_compare = date_range
|
|
557
|
+
if compare == self.CompareOptions.COMPARE_PREVIOUS:
|
|
558
|
+
period_length = (
|
|
559
|
+
date_range_compare[1] - date_range_compare[0]
|
|
560
|
+
).days + 1
|
|
561
|
+
date_range_compare[0] = date_range_compare[0] - timedelta(
|
|
562
|
+
days=period_length
|
|
563
|
+
)
|
|
564
|
+
date_range_compare[1] = date_range_compare[1] - timedelta(
|
|
565
|
+
days=period_length
|
|
566
|
+
)
|
|
567
|
+
if compare == self.CompareOptions.COMPARE_PREVIOUS_YOY:
|
|
568
|
+
date_range_compare[0] = date_range_compare[0].replace(
|
|
569
|
+
year=date_range_compare[0].year - 1
|
|
570
|
+
)
|
|
571
|
+
date_range_compare[1] = date_range_compare[1].replace(
|
|
572
|
+
year=date_range_compare[1].year - 1
|
|
573
|
+
)
|
|
574
|
+
request_data_modified_date_filter.request_get[
|
|
575
|
+
self.date_annotate_field
|
|
576
|
+
] = DateFilterWidget.get_value_from_date_or_range(date_range_compare)
|
|
575
577
|
queryset_with_modified_date = self.get_data_queryset(request_copy)
|
|
576
578
|
|
|
577
579
|
sub_widget_data = {}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Generated by Django 5.0.14 on 2025-08-04 06:22
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
|
|
8
|
+
dependencies = [
|
|
9
|
+
('django_smartbase_admin', '0005_sbadminuserconfiguration'),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.AlterField(
|
|
14
|
+
model_name='sbadminuserconfiguration',
|
|
15
|
+
name='color_scheme',
|
|
16
|
+
field=models.CharField(choices=[('auto', 'System'), ('dark', 'Dark'), ('light', 'Light')], default='auto', max_length=255, verbose_name='Theme'),
|
|
17
|
+
),
|
|
18
|
+
]
|
django_smartbase_admin/models.py
CHANGED
|
@@ -1,25 +1,14 @@
|
|
|
1
1
|
from django.conf import settings
|
|
2
2
|
from django.db import models
|
|
3
|
-
from django.utils.html import format_html
|
|
4
3
|
from django.utils.translation import gettext_lazy as _
|
|
5
4
|
|
|
6
5
|
from django_smartbase_admin.querysets import SBAdminListViewConfigurationQueryset
|
|
7
6
|
|
|
8
|
-
AUTO_LABEL = _("System")
|
|
9
|
-
DARK_LABEL = _("Dark")
|
|
10
|
-
LIGHT_LABEL = _("Light")
|
|
11
|
-
|
|
12
7
|
|
|
13
8
|
class ColorScheme(models.TextChoices):
|
|
14
|
-
AUTO = "auto",
|
|
15
|
-
|
|
16
|
-
)
|
|
17
|
-
DARK = "dark", format_html(
|
|
18
|
-
f'<span class="flex gap-8"><svg class="w-20 h-20"><use href="#Moon"></use></svg><span>{DARK_LABEL}</span></span>'
|
|
19
|
-
)
|
|
20
|
-
LIGHT = "light", format_html(
|
|
21
|
-
f'<span class="flex gap-8"><svg class="w-20 h-20"><use href="#Sun-one"></use></svg><span>{LIGHT_LABEL}</span></span>'
|
|
22
|
-
)
|
|
9
|
+
AUTO = "auto", _("System")
|
|
10
|
+
DARK = "dark", _("Dark")
|
|
11
|
+
LIGHT = "light", _("Light")
|
|
23
12
|
|
|
24
13
|
|
|
25
14
|
class SBAdminListViewConfiguration(models.Model):
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--fc-small-font-size:.75rem;--fc-border-color:var(--color-dark-200);--fc-today-bg-color:var(--color-primary-50);--fc-neutral-bg-color:var(--color-bg-elevated)}.fc-theme-standard th.fc-col-header-cell{background-color:var(--color-bg);padding:.5rem 1.5rem}.fc-theme-standard td.fc-daygrid-day{padding:.5rem}.fc table{font-size:.75rem;line-height:1.25rem}.fc .fc-col-header-cell-cushion{font-size:.875rem;font-weight:500;line-height:1.25rem;padding:0}.fc .fc-daygrid-day{height:9rem}.fc .fc-day-other{background-color:var(--color-bg)}.fc .fc-day-other .fc-daygrid-day-top{opacity:1}.fc .fc-day-other .fc-daygrid-day-top .fc-daygrid-day-number{color:var(--color-dark)}.fc .fc-day-other .fc-daygrid-day-events{opacity:.6}.fc .fc-daygrid-day-bottom:after,.fc .fc-daygrid-day-bottom:before,.fc .fc-daygrid-day-events:after,.fc .fc-daygrid-day-events:before,.fc .fc-daygrid-day-frame:after,.fc .fc-daygrid-day-frame:before,.fc .fc-daygrid-event-harness:after,.fc .fc-daygrid-event-harness:before{display:none}.fc .fc-daygrid-day-events,.fc .fc-daygrid-day-frame{display:flex;flex-direction:column;gap:.25rem}.fc .fc-daygrid-day-events{margin:0}.fc .fc-daygrid-day-top{flex-direction:row}.fc .fc-daygrid-day-number{align-items:center;color:var(--color-dark-900);display:flex;font-weight:600;height:1.5rem;justify-content:center;line-height:1;padding:.25rem;width:1.5rem}.fc .fc-day-today .fc-daygrid-day-number{background-color:var(--color-primary);border-radius:9999px;color:var(--color-light)}.fc .fc-daygrid-event{display:flex;gap:.25rem;margin:0!important}.fc .fc-daygrid-dot-event{border-color:var(--color-dark-200);border-radius:6px;border-width:1px;height:1.5rem;padding:0 .5rem}.fc .fc-daygrid-dot-event .fc-event-time{display:none}.fc .fc-daygrid-dot-event .fc-event-title{color:var(--color-dark-900);font-weight:400;line-height:1rem;text-overflow:ellipsis}.fc .fc-daygrid-event-dot{border-color:currentColor;border-radius:9999px;border-width:2px;box-sizing:border-box;flex-shrink:0;height:.75rem;margin:0;width:.75rem}.fc .fc-daygrid-day-bottom{font-size:.75rem;line-height:1.25rem;margin:0!important}.fc .fc-daygrid-more-link{margin:0;padding:0}.fc .fc-daygrid-more-link:hover{background:none}.fc .fc-daygrid-body-unbalanced .fc-daygrid-day-events{margin-bottom:0;min-height:4rem}.fc .fc-daygrid-day-bg{display:none}.fc .fc-popover{z-index:10}.fc .fc-popover .fc-popover-header{padding:.25rem}.fc .fc-popover .fc-popover-title{font-size:.875rem;line-height:1.25rem}.fc .fc-popover .fc-popover-body{display:flex;flex-direction:column;gap:.25rem;padding:.5rem}.fc .fc-scrollgrid{border-left-width:0}.fc .fc-scrollgrid-section>td,.fc .fc-scrollgrid-section>th{border:0}
|
|
1
|
+
:root{--fc-small-font-size:.75rem;--fc-border-color:var(--color-dark-200);--fc-today-bg-color:var(--color-primary-50);--fc-neutral-bg-color:var(--color-bg);--fc-page-bg-color:var(--color-bg-elevated)}.fc-theme-standard th.fc-col-header-cell{background-color:var(--color-bg);padding:.5rem 1.5rem}.fc-theme-standard td.fc-daygrid-day{padding:.5rem}.fc table{font-size:.75rem;line-height:1.25rem}.fc .fc-col-header-cell-cushion{font-size:.875rem;font-weight:500;line-height:1.25rem;padding:0}.fc .fc-daygrid-day{height:9rem}.fc .fc-day-other{background-color:var(--color-bg)}.fc .fc-day-other .fc-daygrid-day-top{opacity:1}.fc .fc-day-other .fc-daygrid-day-top .fc-daygrid-day-number{color:var(--color-dark)}.fc .fc-day-other .fc-daygrid-day-events{opacity:.6}.fc .fc-daygrid-day-bottom:after,.fc .fc-daygrid-day-bottom:before,.fc .fc-daygrid-day-events:after,.fc .fc-daygrid-day-events:before,.fc .fc-daygrid-day-frame:after,.fc .fc-daygrid-day-frame:before,.fc .fc-daygrid-event-harness:after,.fc .fc-daygrid-event-harness:before{display:none}.fc .fc-daygrid-day-events,.fc .fc-daygrid-day-frame{display:flex;flex-direction:column;gap:.25rem}.fc .fc-daygrid-day-events{margin:0}.fc .fc-daygrid-day-top{flex-direction:row}.fc .fc-daygrid-day-number{align-items:center;color:var(--color-dark-900);display:flex;font-weight:600;height:1.5rem;justify-content:center;line-height:1;padding:.25rem;width:1.5rem}.fc .fc-day-today .fc-daygrid-day-number{background-color:var(--color-primary);border-radius:9999px;color:var(--color-light)}.fc .fc-day-today.fc-day-other .fc-daygrid-day-top .fc-daygrid-day-number{color:var(--color-light)}.fc .fc-daygrid-event{display:flex;gap:.25rem;margin:0!important}.fc .fc-daygrid-dot-event{border-color:var(--color-dark-200);border-radius:6px;border-width:1px;height:1.5rem;padding:0 .5rem}.fc .fc-daygrid-dot-event .fc-event-time{display:none}.fc .fc-daygrid-dot-event .fc-event-title{color:var(--color-dark-900);font-weight:400;line-height:1rem;text-overflow:ellipsis}.fc .fc-daygrid-dot-event.event-positive{background-color:var(--color-success-50);border-color:var(--color-success-200)}.fc .fc-daygrid-dot-event.event-positive .fc-daygrid-event-dot{border-color:var(--color-success)}.fc .fc-daygrid-dot-event.event-warning{background-color:var(--color-warning-50);border-color:var(--color-warning-200)}.fc .fc-daygrid-dot-event.event-warning .fc-daygrid-event-dot{border-color:var(--color-warning)}.fc .fc-daygrid-dot-event.event-negative{background-color:var(--color-negative-50);border-color:var(--color-negative-200)}.fc .fc-daygrid-dot-event.event-negative .fc-daygrid-event-dot{border-color:var(--color-negative)}.fc .fc-daygrid-dot-event.event-notice{background-color:var(--color-notice-50);border-color:var(--color-notice-200)}.fc .fc-daygrid-dot-event.event-notice .fc-daygrid-event-dot{border-color:var(--color-notice)}.fc .fc-daygrid-event-dot{border-color:currentColor;border-radius:9999px;border-width:2px;box-sizing:border-box;flex-shrink:0;height:.75rem;margin:0;width:.75rem}.fc .fc-daygrid-day-bottom{font-size:.75rem;line-height:1.25rem;margin:0!important}.fc .fc-daygrid-more-link{margin:0;padding:0}.fc .fc-daygrid-more-link:hover{background:none}.fc .fc-daygrid-body-unbalanced .fc-daygrid-day-events{margin-bottom:0;min-height:4rem}.fc .fc-daygrid-day-bg{display:none}.fc .fc-popover{z-index:10}.fc .fc-popover .fc-popover-header{padding:.25rem}.fc .fc-popover .fc-popover-title{font-size:.875rem;line-height:1.25rem}.fc .fc-popover .fc-popover-body{display:flex;flex-direction:column;gap:.25rem;padding:.5rem}.fc .fc-scrollgrid{border-left-width:0}.fc .fc-scrollgrid-section>td,.fc .fc-scrollgrid-section>th{border:0}
|